[jboss-user] [JBoss Microcontainer Development] New message: "Modules with null ClassLoaders"

Flavia Rainone do-not-reply at jboss.com
Fri Feb 5 07:18:24 EST 2010


User development,

A new message was posted in the thread "Modules with null ClassLoaders":

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

Author  : Flavia Rainone
Profile : http://community.jboss.org/people/flavia.rainone@jboss.com

Message:
--------------------------------------------------------------
I have just found out that ClassPoolRepository is registering null class loaders.
JBossClDelegatingClassPoolFactory.create method has a call to registerBootstrapClassLoaders
 
public synchronized AbstractClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
   {
      if (this.currentClassLoaders.contains(cl))
      {
         return null;
      }
      currentClassLoaders.add(cl);
      try
      {
         ClassPool parent = getCreateParentClassPools(cl, src, repository);
         
         if (cl instanceof RealClassLoader)
         {
            Module module = registry.getModule(cl);
            if (module == null)
            {
               module = getModuleForClassLoader(cl);
            }
            registerModuleCallback.registerModule(module);
 --->           registerBootstrapLoaders(module, repository);
...
}

 
This is the implementation of registerBootstrapLoaders:
 
private void registerBootstrapLoaders(Module skip, ScopedClassPoolRepository repository)
   {
      Collection<Module> unregistered = registerModuleCallback.getUnregisteredModules();
      if (unregistered.size() > 0)
      {
         for (Module module : unregistered)
         {
            if (module == skip)
            {
               continue;
            }
            ClassLoader loader = getClassLoaderForModule(module);
            if (this.currentClassLoaders.contains(loader))
            {
               continue;
            }
            ClassPool classPool = repository.registerClassLoader(loader);
            if (classPool == null)
            {
               repository.unregisterClassLoader(loader);
            }
         }
      }
   }

 
The problem is that many of those modules, if not all, have a null class loader at this point.
 
I'll try skipping the registration of such modules to see if any test breaks. Does anybody has a better idea on how to fix this?

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

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




More information about the jboss-user mailing list