Community

Cannot load package from deployment that has dynamic imports

created by Thomas Diesler in JBoss Microcontainer Development - View the full discussion

The symptom is that we see WARN messages like this

 

09:04:13,595 WARN  [BaseDelegateLoader] Not getting package org.osgi.service.log from policy that has no classLoader: LazyFilteredDelegateLoader@a75737{factory=org.jboss.classloading.spi.dependency.policy.DynamicClassLoaderPolicyFactory@4f0853 filter=<EVERYTHING>}
09:04:13,599 WARN  [BaseDelegateLoader] Not getting package org.osgi.service.log from policy that has no classLoader: LazyFilteredDelegateLoader@a75737{factory=org.jboss.classloading.spi.dependency.policy.DynamicClassLoaderPolicyFactory@4f0853 filter=<EVERYTHING>}
09:04:13,727 WARN  [BaseDelegateLoader] Not getting package org.osgi.util.tracker from policy that has no classLoader: LazyFilteredDelegateLoader@a75737{factory=org.jboss.classloading.spi.dependency.policy.DynamicClassLoaderPolicyFactory@4f0853 filter=<EVERYTHING>

 

The reason seems that the BaseClassLoaderDomain uses this sematics in getPackage

 

  1. // Try the before attempt
  2. // Next we try the old "big ball of mud" model
  3. // Next we try the imports  
  4. // Finally use any requesting classloader
  5. // Try the after attempt

 

In step #3 the imports also include the dynamic imports (even the EVERYTHING aka '*' imports)

The  LazyFilteredDelegateLoader has no classloader associated and getPackage fails.

 

In OSGi dynamic imports are considered after the bundles embedded classpath.

 

I suggest we split getPackageFromImports in two variants and consider dynamic import between step #4 and #5

Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer Development at Community