2 Replies Latest reply on Jun 4, 2009 9:49 AM by bryan.kearney

    Deployers, Classloaders, and Reflection in JBoss 5

    bryan.kearney

      We are working on a deployer for JBoss 5, which exposes entity beans to a QMF bus (http://qpid.apache.org/qpid-management-framework.html). The main engine takes EJB interfaces and invokes methods on the class via reflection. The deployer loads up this engine, and scans the deployment units at startup looking for a certain annotation. If the annotation is found, it loads the interface into the engine.

      We have an issue, I believe, with class loaders during redeploy. The firs load everything works fine. The engine code is the in the deployer, and therefore in one classloader (I assume). The classes which are wrapped are in the apps classloader, but I assume are brought into the deployers classloader. When a redeploy happens, everything seems to work until I get to the reflection part. When the engine looks for a method to invoke with the signature:

      foo(TypeA a, TypeB b)

      it does not find that method. It is, as if, there are 2 typeA's in memory (which there should be because of the reload).

      So.. My question is are there good examples I can look at for these types of issues. I looked at the seam deployers, and they appear to put the seam code in the app. I looked at the WebService deployers but was not able to see any classloader magic going on. Any pointers or examples on how best to handle the reloading would be appreciated.

      Thanks!

      -- bk