I have looked at your example and don't see anything that you have missed.
But I could have missed something ;-)

It should work and I think the OSGi CT has similar testcases.  Next step is
for you to open a bug report with the test bundle and jar and the command
line we can use to reproduce.

Tom




|------------>
| From:      |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Tim Diekmann <[email protected]>                                            
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Equinox development mailing list <[email protected]>                   
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |04/18/2011 03:00 PM                                                          
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |[equinox-dev] Bootdelegation issue                                           
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|





Hi, I have a question about boot delegation in Equinox. My feeling is that
it is not working according to the spec.

The spec says:
If the class or resource is from a package included in the boot delegation
list (org.osgi.framework.bootdelegation), then the request is delegated to
the parent class loader. If the class or resource is found there, the
search ends.

My test client uses a class that it does not import. According to the spec
it is not necessary, since the fw has to delegate all packages to the
parent class loader  if the package is listed in
org.osgi.framework.bootdelegation.
At runtime, it fails to load the APIClass.



test client:
package com.tibco.osgi.bootdelegation;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

import com.tibco.osgi.bd.api.APIClass;

/**
 * @author timd
 *
 */
public class BootdelegationTest implements BundleActivator{

@Override
public void start(BundleContext context) throws Exception {
        System.out.println(APIClass.getMessage());
}

@Override
public void stop(BundleContext context) throws Exception {
// TODO Auto-generated method stub

}

}

Manifest.mf (not importing the package!)
Bundle headers:
 Bundle-Activator = com.tibco.osgi.bootdelegation.BootdelegationTest
 Bundle-ManifestVersion = 2
 Bundle-Name = Bootdelegation
 Bundle-RequiredExecutionEnvironment = JavaSE-1.6
 Bundle-SymbolicName = com.tibco.osgi.bootdelegation
 Bundle-Version = 1.0.0.201104181155
 Import-Package = org.osgi.framework;version="1.6.0"
 Manifest-Version = 1.0


test provider:
package com.tibco.osgi.bd.api;

/**
 * @author <a href="mailto:[email protected]";>Tim Diekmann</a>
 *
 * @since
 */
public class APIClass {
    public static String getMessage() {
        return "This is from the system class loader";
    }
}

Command line:
java -classpath
org.eclipse.osgi_3.7.0.v20110304.jar:com.tibco.osgi.bd.api_1.0.0.201104181140.jar
 -Dorg.osgi.framework.bootdelegation=com.tibco.osgi.bd.*
org.eclipse.core.runtime.adaptor
.EclipseStarter -console

Result:
java.lang.NoClassDefFoundError: com/tibco/osgi/bd/api/APIClass
at com.tibco.osgi.bootdelegation.BootdelegationTest.start
(BootdelegationTest.java:16)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run
(BundleContextImpl.java:711)

Configuration:
Equinox
   org.eclipse.osgi_3.7.0.v20110304
Java:
  java version "1.6.0_24"
  Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
  Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)

Any suggestions what I am missing here?

I also tried the variant on the command line to change the parent class
loader of the bundle class loaders to app and framework. No change. Adding
the package to org.osgi.framework.system.packages.extra did not help
either.

java -classpath
org.eclipse.osgi_3.7.0.v20110304.jar:com.tibco.osgi.bd.api_1.0.0.201104181140.jar
 -Dorg.osgi.framework.bootdelegation=com.tibco.osgi.bd.*
-Dorg.osgi.framework.bundle.pare
nt=app -Dorg.osgi.framework.system.packages.extra=com.tibco.osgi.bd.api
org.eclipse.core.runtime.adaptor.EclipseStarter -console

Thanks,

      Tim.
_______________________________________________
equinox-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/equinox-dev

<<inline: graycol.gif>>

<<inline: ecblank.gif>>

_______________________________________________
equinox-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/equinox-dev

Reply via email to