[jboss-user] [JBoss Microcontainer] New message: "Re: Classloaders & Domains: Some questions & a suggestion"

Ales Justin do-not-reply at jboss.com
Tue Feb 16 11:55:43 EST 2010


User development,

A new message was posted in the thread "Classloaders & Domains: Some questions & a suggestion":

http://community.jboss.org/message/526600#526600

Author  : Ales Justin
Profile : http://community.jboss.org/people/alesj

Message:
--------------------------------------------------------------
> Nope. I'll have a closer look.
OK, I hacked a small test for this -- which proves my right. ;-)
 
See attached zip:
* dummy -- placed into default domain
* transl -- simple translator/hello service
* starter -- uses translator + tries to load Dummy from dummy
 
Since starter explicitly declares its requirements:
 
<classloading xmlns="urn:jboss:classloading:1.0">
   <requirements>
      <package name="com.alesj.spi"/>
   </requirements>
</classloading>

 
it doesn't see Dummy in start()
 
   public void start() throws Exception
   {
      Class<?> aClass = getClass().getClassLoader().loadClass("net.dummy.test.Dummy");
      System.out.println("aClass = " + aClass);
   }

 
as shown here:
 
java.lang.ClassNotFoundException: net.dummy.test.Dummy from BaseClassLoader at 2dd59d3c{vfszip:/Users/alesj/projects/demos/mc/sandbox/starter.jar/}
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:498)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
    at org.acme.services.Startup.start(Startup.java:42)

 
If I remove jb-cl.xml in starter.jar, all is fine, as we can see the default domin and its dummy.jar/Dummy.class.

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/526600#526600




More information about the jboss-user mailing list