Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] org.osgi.framework.bootdelegation not working?

The org.osgi.framework.bootdelegation property is used to list packages that should be boot delegated. Setting it to "true" only boot delegates for classes in the "true" package. You indicated that you have tried to use the actual package name so that is not the only issue for getting this to work. To launch the framework you are using the following command line:

java -cp org.eclipse.osgi_3.6.2.R36x_v20110210.jar:bootclasses.jar \
        -Dorg.osgi.framework.bootdelegation=true
        -Dosgi.configuration.area=some/Path
        org.eclipse.core.runtime.adaptor.EclipseStarter



The issue is that you are placing the bootclasses.jar on the application class loader along with the org.eclipse.osgi jar. This is not the boot class loader. Bundle class loaders are not by default parented by the application class loader. They are parented by the boot class loader. You will need to place you jar on the boot class path of the VM (with some VM specific setting) or another option is to use a framework configuration property to cause the bundle class loader parent to be the application class loader with the option org.osgi.framework.bundle.parent=boot. The following should work:

java -cp org.eclipse.osgi_3.6.2.R36x_v20110210.jar:bootclasses.jar \
        -Dorg.osgi.framework.bootdelegation=true
        -Dosgi.configuration.area=some/Path

-Dorg.osgi.framework.bundle.parent=boot
        org.eclipse.core.runtime.adaptor.EclipseStarter


Tom



Inactive hide details for Bruce Bohannan ---04/11/2011 01:32:42 AM---I am trying to get eclipse-osgi running in a standalone jaBruce Bohannan ---04/11/2011 01:32:42 AM---I am trying to get eclipse-osgi running in a standalone java program and am having problems with getting bootclass delegation t


From:

Bruce Bohannan <bbohannan@xxxxxxxxx>

To:

eclipse-dev@xxxxxxxxxxx

Date:

04/11/2011 01:32 AM

Subject:

[eclipse-dev] org.osgi.framework.bootdelegation not working?




I am trying to get eclipse-osgi running in a standalone java program and am having problems with getting bootclass delegation to work.


I have a simple example, with a bootclasses.jar with one class in it ("com.rsc.nonBundle.Bob").

The tinkertoy class is

package com.rsc.nonBundle;

/**
 * class example to be put on the classpath, not in a bundle
 */
public class Bob
{
   public Bob()
   {
   }
}

I  have s simple OSGI plugin which runs fine.  When I add this to my derived BundleActivator's start() method

        // look for a class on the system class path

        try
        {
           Bob bob = new Bob();
           System.out.println("Activator.

start() found non-bundle class");
        }
        catch(Throwable e)
        {
           System.out.println("Activator.start() didn't find non-bundle class");
           e.printStackTrace();
        }

then it starts throwing a ClassNotFound exception.

I've tried to run it with org.osgi.framework.bootdelegation defined to true

java -cp org.eclipse.osgi_3.6.2.R36x_v20110210.jar:bootclasses.jar \
        -Dorg.osgi.framework.bootdelegation=true
        -Dosgi.configuration.area=some/Path
        org.eclipse.core.runtime.adaptor.EclipseStarter

Here is the stack trace:

runE:
     [java] Activator Start
     [java] In Factory Accessor
     [java] In Factory Accessor returning: com.rsc.vtk.impl.fragment2.Fragment2Factory@28bb0d0d
     [java] In getMessage
     [java] com.vividsolutions.jts.JTSVersion
     [java] Activator.start() didn't find non-bundle class
     [java] java.lang.NoClassDefFoundError: com/rsc/nonBundle/Bob
     [java]     at com.rsc.vtk.impl.host.Activator.start(Activator.java:38)
     [java]     at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
     [java]     at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
     [java]     at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
     [java]     at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:374)
     [java]     at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1067)
     [java]     at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:561)
     [java]     at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:546)
     [java]     at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:459)
     [java]     at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
     [java]     at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:440)
     [java]     at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
     [java]     at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:337)
     [java] Caused by: java.lang.ClassNotFoundException: com.rsc.nonBundle.Bob
     [java]     at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
     [java]     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
     [java]     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
     [java]     at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
     [java]     ... 15 more

I have experimented with setting osgi.compatibility.bootdelegation=false and org.osgi.framework.bootdelegation=* to no avail.

I've tried org.osgi.framework.system.packages=com.rsc.nonBundle to no avail.

I'm running with a newish copy of org.eclipse.osgi.jar (org.eclipse.osgi_3.6.2.R36x_v20110210.jar)

I'm sure I'm doing something wrong: Der Google does not show many hits on this property not working.

Any help would be appreciated.


b
_______________________________________________
eclipse-dev mailing list
eclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipse-dev


GIF image

GIF image


Back to the top