On Jan 15, 2008 4:48 AM, Sahoo <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am having trouble starting Felix when I use
> -Dorg.osgi.framework.bootdelegation="*". When I run using the following
> command:
> '/usr/bin/java -Dorg.osgi.framework.bootdelegation="*" -jar
> bin/felix.jar', it fails like this:
>
> WARNING: *** Class 'org.apache.felix.shell.impl.Activator' was not
> found. Bundle 1 does not import package 'org.apache.felix.shell.impl',
> nor is the package exported by any other bundle or available from the
> system class loader. *** (java.lang.ClassNotFoundException: *** Class
> 'org.apache.felix.shell.impl.Activator' was not found. Bundle 1 does not
> import package 'org.apache.felix.shell.impl', nor is the package
> exported by any other bundle or available from the system class loader.
> ***)ERROR: Error starting
> file:bundle/org.apache.felix.shell-1.1.0-SNAPSHOT.jar
> (org.osgi.framework.BundleException: Not found:
> org.apache.felix.shell.impl.Activator)
> java.lang.ClassNotFoundException: org.apache.felix.shell.impl.Activator
>         at
> org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3438)
> at org.apache.felix.framework.Felix._startBundle(Felix.java:1540)
>         at org.apache.felix.framework.Felix.startBundle(Felix.java:1479)
>         at
> org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1074)
> at
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:258)
> at java.lang.Thread.run(Thread.java:595)
>
> Section #3.8.4, Overall Search Order, of OSGi Service Platform Release 4
> spec does not clearly (or I don't understand it well enough) state what
> should be the behavior. Relevant portions of the spec is given below:
>
> /1 If the class or resource is in a java.* package, the request is
> delegated to the parent class loader; otherwise, the search continues
> with the next step. If the request is delegated to the parent class
> loader and the class or resource is not found, then the search
> terminates and the request fails.
> 2 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.
> /
> Unlike point #1 above, point #2 does not mandate the search to
> terminate. I can understand the search terminating for java.* packages,
> but why for other packages? It seems Felix is terminating the search,
> therefore I am seeing this failure. Can anyone please clarify this? I am
> using "*, " because I want to see how I can make packages from some
> library jars available to bundles without having to set
> org.osgi.framework.system.packages property?
>
> I am hoping that if I add my library jars in system classpath and set
> bootdelegation="*", the library jar's content will be automatically
> available to other bundles even if I don't set
> org.osgi.framework.system.packages property. Is this not going to work?

No. It doesn't work like this. You still need to make the packages
your bundles explicitly import available form the system bundle (i.e.,
add them to the system.packages property). The bootdelegation is
needed only for the case where you want to make packages available to
bundles _without_ them needing to import them. However, if they import
them then it doesn't work. In other words, this is not a bug in Felix
but you will have to adjust your assumptions.

What happens in your case is that the bootdelegation=* effectively
short-cuts the whole resolving process and makes Felix use the
bootclassloader _all_ the time. That one, however, doesn't know about
classes that come from a bundle -- hence, the CNFE. As Felix
Meschberger mentions, do try to avoid using the bootdelegation feature
unless your really need it - it's not a convenience feature but a last
resort.

regards,

Karl

> Thanks,
> Sahoo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Karl Pauls
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to