JBoss Community

About JBoss5 classloader

reply from nesta fdb in JBoss Microcontainer - View the full discussion

Hi Ales,


Thank you very much.

Yup, both should be in the same domain - DefaultDomain.

How can you tell B is not visible to A?


A.java snippet
public class A {
     public void start() {
          // and print parent and ancestor classloader
          System.out.println(new B());


When JBoss starts, NoClassDefFoundError is thrown out.


According to my understanding, two BaseClassLoader instances for a.beans and b.beans share a same class repository (DefaultDomain). If B is visible to A, then BaseClassLoader for a.beans can load class B.
The scenario contains servel steps:
1. BaseClassLoaders are registered to class repository (DefaultDomain)
2. BaseClassLoader for a.beans trys to load class B, and it trys from class repository, but it can't find.
3. Because BaseClassLoader for b.beans declares that it can load class B
4. Class repository delegates BaseClassLoader for b.beans to load class B


But this doesn't explain why NoClassDefFoundError happens.


Another question:
When is contextClassLoader of current thread set in JBoss5?



Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer at Community