felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall" <he...@ungoverned.org>
Subject Re: Fixed bug in class loading
Date Mon, 10 Apr 2006 10:21:15 GMT
John E. Conlon wrote:
> As you mentioned after the change I had to edit my bundle Import-Package
> headers to get bundles to resolve without NoClassDefFoundErrors. 
> Now the tough part about this was that I had to not only import all the
> javax classes I was using but also the sun, and even the com.sun
> packages in the imports as well.  Then I had to add the various
> javax.xxx, sun.xxx and com.sun.xxx packages to the config.properties
> file's org.osgi.framework.system.packages property as well.

I wanted to follow up on this, just to make sure I understand the 
situation. Are you actually using sun.* and com.sun.* classes directly 
in your code? Or are you referring to a situation where you are running 
into the bug I mentioned where your bundle does not directly use these 
classes but you are still getting a class loading error?

I just want to make sure I understand the situation. If you are using 
them directly, I guess I could also add that this is risky business 
depending on Sun impl classes. :-)

> Now I must confess that reading the classloading part of the OSGi spec
> makes my eyes glaze over, but I did notice section 3.8.3 discussion of
> parent delegation. It talks about a bootdelegation property that can add
> packages to the parent classloader like this:
> property org.osgi.framework.bootdelegation=sun.*,com.sun.*
> Maybe I am paranoid but I feel uncomfortable doing anything (even
> declaring imports in bundles) with the sun and com.sun packages. Could
> the bootdelegation property eventually come to the rescue?

I have the boot delegation property working in my workspace...I will try 
to test it a little more to make sure that it appears to be working and 
I will commit it in the next couple of hours.

-> richard

> cheers,
> John
> On Wed, 2006-04-05 at 04:54 -0400, Richard S. Hall wrote:
>> Hello everyone,
>> I just wanted to let you know that I discovered and fixed a bug in Felix 
>> class loading that was accidentally exposing classes on the class path 
>> to bundles, even if they did not import them.
>> This bug was introduced during the module layer refactoring.
>> I am posting a message about this to let people know that they should 
>> "svn update" and after they do, they might experience 
>> NoClassDefFoundErrors and the like if their bundles' manifests are 
>> incomplete. If you run into this situation, most likely, you just need 
>> to add the package to the Import-Package header of the bundle.
>> -> richard

View raw message