felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall" <he...@ungoverned.org>
Subject Re: org.osgi.framework.bootdelegation and org.osgi.framework.system.packages.extra
Date Wed, 02 May 2012 14:30:08 GMT
For the boot delegation property, org.foo.* does not match org.foo, only 
sub-packages like org.foo.bar.

Also, you may have to set the org.osgi.framework.bundle.parent (name?) 
property to be something like "app" or "framework" or something...check 
the spec for correct names/values.

-> richard

On 5/2/12 10:18 , Gay David (Annecy) wrote:
> Hi all,
>
> I'm trying to understand and use Felix osgi properties o.o.f.bootdelegation and o.o.f.s.packages.extra
> My main goal is to be able to integrate some legacy, non osgi code into Felix.
>
> I've read ton of articles and pointer regarding these properties. But I still have one
understanding problem.
>
> Here is my case :
>
> * The class I want to use is located in a jar named foo.jar. Inside this jar, there is
a class com.foo.Foo
> * This jar is added in the JVM classpath that start Felix
> * I made a bundle use-foo.jar that do somewhere this code : Class c = Class.forName(
"com.foo.Foo" );
>
>
> First try with packages.extra :
>
> * use-foo.jar has the manifest info : Import-Package = com.foo
> * I use org.osgi.framework.system.packages.extra=com.foo
>
> It works ok, cool !
>
>
> Now, the problem is by using bootdelegation, I understand that it could be used without
having to specify Import-Package directive, so second try  :
>
> * Use-foo.jar has not the Import-Package = com.foo (even if set, it doesn't works but
not the same error)
> * I use org.osgi.framework.bootdelegation=sun.*,com.sun.*,com.foo.*
>
>                  It doesn't work, oups !
>
> Felix debug is :
>
> DEBUG: WIRE: [1.0] osgi.wiring.package; (osgi.wiring.package=org.osgi.framework) ->
 [0]
> java.lang.ClassNotFoundException:
> *** Package 'com.foo' is not imported by bundle com.use-foo [1], nor is there any bundle
that exports package 'com.foo'.
> However, the class 'com.foo.Foo' is available from the system class loader.
> There are two fixes:
> 1) Add package 'com.foo' to the 'org.osgi.framework.system.packages.extra' property and
modify bundle com.use-foo [1] to import this package; this causes the system bundle to export
class path packages.
> 2) Add package 'com.foo' to the 'org.osgi.framework.bootdelegation' property; a library
or VM bug can cause classes to be loaded by the wrong class loader. The first approach is
preferable for preserving modularity. ***
>
> So, AFAIU, this second try is the fix 2, but it doesn't works.
> I'm sure I miss or misunderstand something.
> Also, I use Felix 4.0.2 and JVM 1.6.0_26
>
>
> PS : I know that the second solution is not the best approach, but in reality my problem
is much more complex : it deals with JVM security provider and ton of legacy code and I would
like to have a first working integration and clean it later. And last but not least : I like
to understand what I don't understand ;-)
>
> Thanks for any helps.
> WBR // David G.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message