[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: NPE in CLSpace

adrian@jboss.org do-not-reply at jboss.com
Fri Dec 5 07:54:19 EST 2008


"alesj" wrote : 
  | And you end up with
  | 
  |   | JBoss-MC-Demo ERROR [04-12-2008 23:56:08] AbstractKernelController - Error resolving dependencies for ClassLoader: name=vfsfile:/C:/projects/demos/sandbox/deployers/ state=Describe mode=Manual requiredState=ClassLoader
  |   | java.lang.NullPointerException
  |   | 	at org.jboss.classloading.spi.dependency.ClassLoadingSpace.resolve(ClassLoadingSpace.java:325)
  |   | 	at org.jboss.classloading.spi.dependency.ClassLoadingSpace.joinAndResolve(ClassLoadingSpace.java:122)
  |   | 	at org.jboss.classloading.spi.dependency.ClassLoadingSpace.joinAndResolve(ClassLoadingSpace.java:169)
  |   | 	at org.jboss.classloading.spi.dependency.ClassLoadingSpace.resolve(ClassLoadingSpace.java:325)
  |   | 	at org.jboss.classloading.spi.dependency.Module.resolveModule(Module.java:737)
  |   | 	at org.jboss.classloading.spi.dependency.RequirementDependencyItem.resolve(RequirementDependencyItem.java:87)
  |   | 	at org.jboss.dependency.plugins.AbstractDependencyInfo.resolveDependencies(AbstractDependencyInfo.java:143)
  |   | 	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1103)
  |   | 	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1039)
  |   | 	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
  |   | 	at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
  |   | 	at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
  |   | 	at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
  |   | 	at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:545)
  |   | 	at org.jboss.demos.bootstrap.MainDeployerHelper.process(MainDeployerHelper.java:86)
  |   | 
  | 
  | The cause is the CLMD/module with import-all="true" and this code in Domain::addModule
  | 
  |   |          // Skip the classloader space checking when it is import all
  |   |          if (module.isImportAll() == false)
  |   |          {
  |   |             ClassLoadingSpace space = new ClassLoadingSpace();
  |   |             space.join(module);
  |   |          }
  |   | 
  | Module never joins any CLSpace.

The NPE is obviously a bug, but the import-all not taking part in the ClassloadingSpace
checking is correct.

When you have import-all=true you can't really check consistency
because the imports are not deterministic.
i.e. you import everything so there is no way for it know what you actually import.

The fix looks fairly trivial?

  |                Module otherModule = module.resolveModule(dependency, false);
  |                if (otherModule != null)
  |                {
  |                   // Do we need to join with another classloading space?
  |                   ClassLoadingSpace space = otherModule.getClassLoadingSpace();
  | -                  if (this != space)
  | +                  if (space != null && this != space)
  |                      space.joinAndResolve(this);
  |                }
  | 

But we probably also want to log a warning if one of our explicit imports
resolves to a module with import-all=true? i.e. the resolved module has 
no classloading space.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4194608#4194608

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4194608



More information about the jboss-dev-forums mailing list