nesta fdb [
http://community.jboss.org/people/jnesta] replied to the discussion
"About JBoss5 classloader"
To view the discussion, visit:
http://community.jboss.org/message/555092#555092
--------------------------------------------------------------
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() {
System.out.println(this.getClass()..getClassLoader());
// 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?
Regards,
Nesta
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/555092#555092]
Start a new discussion in JBoss Microcontainer at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]