[jboss-user] [Microcontainer] - Deployment callbacks fail on static methods

jaikiran do-not-reply at jboss.com
Tue Feb 10 02:53:38 EST 2009


I was following this chapter on Deployment Callbacks http://www.jboss.org/file-access/default/members/jbossmc/freezone/docs/2.0.x/userGuide/ch13s02.html. Works fine except when the callback method is marked static. So if i have this:

<bean name="MyRegistry" class="org.myapp.registry.MyRegistry">
  | 
  |       <incallback method="addToRegistry"/>
  |       <uncallback method="removeFromRegistry"/>
  |     </bean>
  | 


  | public class MyRegistry
  | {
  | 
  |    public static void addToRegistry(SomeType obj)
  |    {
  | 	// do something
  |    }
  | 
  |    public static void removeFromRegistry(SomeType obj)
  |    {
  | 	// do something
  |    }
  | 
  | 
  | This fails with:

Caused by: org.jboss.joinpoint.spi.JoinpointException: Method not found removeFromRegistry[null] for class org.myapp.registry.MyRegistry
  | 	at org.jboss.joinpoint.plugins.Config.findMethodInfo(Config.java:399)
  | 	at org.jboss.joinpoint.plugins.Config.findMethodInfo(Config.java:365)
  | 	at org.jboss.joinpoint.plugins.Config.findMethodInfo(Config.java:334)
  | 	at org.jboss.beans.metadata.plugins.AbstractCallbackMetaData.describeVisit(AbstractCallbackMetaData.java:182)
  | 	... 49 more

Making those methods non-static gets it working. From what i see in the AbstractCallbackMetaData, it uses an API on jboss-reflect which does not look for static methods. The jboss-reflect does provide an overriden method allowing lookup of static methods. Is it intentional not to allow callbacks to static methods?


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4208383#4208383

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4208383



More information about the jboss-user mailing list