[jboss-dev-forums] [JBoss OSGi Development] - HOWTO chage the behaviour of the CL policy

thomas.diesler@jboss.com do-not-reply at jboss.com
Mon Aug 24 12:59:28 EDT 2009


Currently bundle class loading uses VFSClassLoaderPolicy, which seems to load the class from the private packages first rather than considering imports.

This is related to 

https://jira.jboss.org/jira/browse/JBOSGI-135

How can I configure/swap the policy being used?

More specifically I see in BaseClassLoaderDomain that


  |    Loader findLoaderInImports(ClassLoaderInformation info, String name, boolean trace)
  |    {
  |       List<? extends DelegateLoader> delegates = info.getDelegates();
  |       if (delegates == null || delegates.isEmpty())
  |       {
  |          if (trace)
  |             log.trace(this + " not loading " + name + " from imports it has no delegates");
  |          return null;
  |       }
  | 

does not have delegates for imports.

At the end of the day I want org.apache.felix.log.jar to load [org.osgi.service.log.LogService] from org.osgi.compendium.jar

You can reproduce the issue by running


  | [tdiesler at tdvaio trunk]$ mvn -Dtest=SimpleLogServiceTestCase test
  | 
  | Running org.jboss.test.osgi.integration.simple.SimpleLogServiceTestCase
  | FIXME [JBOSGI-135] Cannot handle package beeing imported and exported by the same bundle
  | Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.355 sec
  | 

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

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



More information about the jboss-dev-forums mailing list