Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343208

Summary: bootdelegation property not honored
Product: [Eclipse Project] Equinox Reporter: Tim Diekmann <tdiekman>
Component: FrameworkAssignee: Thomas Watson <tjwatson>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bartoszpop
Version: 3.7   
Target Milestone: 3.7 M7   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
bundle files to reproduce, README.txt with instructions
none
Proposed fix none

Description Tim Diekmann CLA 2011-04-18 17:49:59 EDT
Created attachment 193536 [details]
bundle files to reproduce, README.txt with instructions

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



Tim Diekmann ---04/18/2011 03:00:34 PM---Hi, I have a question about boot delegation in Equinox. My feeling is that it is not working according to the spec. The spec s


From:	
Tim Diekmann <tdiekman@tibco.com>

To:	
Equinox development mailing list <equinox-dev@eclipse.org>

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:tdiekman@tibco.com">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.
Comment 1 Tim Diekmann CLA 2011-04-18 17:50:54 EDT
Steps to reproduce are documented in the attached zip file
Comment 2 Thomas Watson CLA 2011-04-19 11:17:41 EDT
Created attachment 193592 [details]
Proposed fix

The issue is when EclipseStarter is used some of the standard osgi launching properties are ignored.

Until this is fixed you can use the Equinox specific osgi.parentClassloader=app configuration option.
Comment 3 Thomas Watson CLA 2011-04-19 11:18:57 EDT
Patch released.