Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » No DynamicImport-Package in Scoped Bundle?
No DynamicImport-Package in Scoped Bundle? [message #663591] Tue, 05 April 2011 18:03 Go to next message
Aaron  is currently offline Aaron Friend
Messages: 21
Registered: February 2011
Junior Member
I'm using Jabsorb to do JSON marshalling/unmarshalling within my Virgo OSGi application. I created an OSGi bundle for Jabsorb and found that I had to add DynamicImport-Package=* to its manifest because Jabsorb uses Class.forName(String name) during unmarshalling. If you need to understand why Class.forName(String name) is an issue, read this. I understand there are other ways to deal with this issue, but DynamicImport-Package seems like a reasonable solution for a serialization library.

Anyway, DynamicImport-Package for my Jabsorb bundle seems to work great until I use it within an application defined by a scoped plan. It works fine without a plan and it works fine within an application defined by an un-scoped plan. To clarify, Jabsorb is not referenced directly in my plan, but it is used as a runtime dependency via OSGi dependency resolution.

I'd like to use a scoped plan to get the nice Virgo logging benefits that I only seem to get with scoped plans.

Any ideas what could be going on here?

Thanks,
Aaron
Re: No DynamicImport-Package in Scoped Bundle? [message #663609 is a reply to message #663591] Tue, 05 April 2011 20:23 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Unless you include Jabsorb in the scoped plan, it will reside outside the scope and its dynamic package import will be unable to wire to the packages exported by the bundles in the scoped plan.

BTW please note dynamic import * is rather an anti-pattern. In particular, it cannot cope when it needs to import a package of which there are multiple versions available in the framework: you'll be lucky if you get the version you need.
Re: No DynamicImport-Package in Scoped Bundle? [message #663897 is a reply to message #663609] Wed, 06 April 2011 18:19 Go to previous messageGo to next message
Aaron  is currently offline Aaron Friend
Messages: 21
Registered: February 2011
Junior Member
Thanks for the information, Glyn. That makes sense. I didn't understand that bundles resolved as dependencies of a plan were not within the plan scope.

As far as DynamicImport-Package:* goes, is there a better way to deal with that situation? I looked at using fragments, but it seems weird to have to create and register a fragment for every library containing classes that need to be serialized.

Thanks,
Aaron
Re: No DynamicImport-Package in Scoped Bundle? [message #664294 is a reply to message #663897] Fri, 08 April 2011 10:07 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Aaron wrote on Wed, 06 April 2011 19:19
Thanks for the information, Glyn. That makes sense. I didn't understand that bundles resolved as dependencies of a plan were not within the plan scope.

As far as DynamicImport-Package:* goes, is there a better way to deal with that situation? I looked at using fragments, but it seems weird to have to create and register a fragment for every library containing classes that need to be serialized.

Thanks,
Aaron


Unless Jabsorb also uses the thread context class loader, possibly not. In that scenario, fragments would have a similar limitation to dynamicimport-package: * - you would be limited to one version of each package that needs to be serialised.
Re: No DynamicImport-Package in Scoped Bundle? [message #664447 is a reply to message #664294] Fri, 08 April 2011 22:12 Go to previous message
Aaron  is currently offline Aaron Friend
Messages: 21
Registered: February 2011
Junior Member
Alright. Thanks for the information. Maybe I can find a way to use a different serializer with Jabsorb.
Previous Topic:Swing applications based on Virgo
Next Topic:[Solved]Unable to add plugin
Goto Forum:
  


Current Time: Wed Dec 04 16:40:17 GMT 2024

Powered by FUDForum. Page generated in 0.04613 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top