Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Problem exporting plugins from PDE
Problem exporting plugins from PDE [message #89148] Fri, 01 June 2007 04:51 Go to next message
Subbarao Meduri is currently offline Subbarao MeduriFriend
Messages: 4
Registered: July 2009
Junior Member
Greetings,

I have a Equinox application that loads a few Jars on the system classpath (e.g., via "-classpath"
option), and my application uses "osgi.parentClassLoader=app" so that these classes are visible to
my plugins (via Equinox's default parent-first boot delegation mechanism). While this works at
runtime (when I handcraft a bundle), I am having trouble trying to create(export) the bundle from
PDE - the wizard produces several errors (and rightly so!) "The import <foo> cannot be resolved".

How can I configure PDE to indicate the Jars loading via system classpath, so that it can
successfully generate/export a valid bundle Jar ?

Regards,
Subbarao
Re: Problem exporting plugins from PDE [message #89162 is a reply to message #89148] Fri, 01 June 2007 06:28 Go to previous messageGo to next message
Danail Nachev is currently offline Danail NachevFriend
Messages: 110
Registered: July 2009
Senior Member
Hi,

If you have this package <foo> in one of your Import-Package clauses,
then you must have it in one Export-Package. I wonder what is the reason
that this jars are not made bundles. If your jars are in the app
classpath, you should export the packages as system packages. These are
packages exported by system.bundle (or org.eclipse.osgi, these are the
same thing). The best way to do it is via a framework extension bundle.
This is fragment, whose Fragment-Host is the system.bundle. It should
not contain any classes and will only export the package(s) you are
interested in.

If there isn't any particular reason that the few jars cannot be
converted as bundles, I strongly encourage you to spend some time
converting to bundles. After all this what OSGi is made for:)

Danail Nachev

Subbarao Meduri wrote:
> Greetings,
>
> I have a Equinox application that loads a few Jars on the system classpath (e.g., via "-classpath"
> option), and my application uses "osgi.parentClassLoader=app" so that these classes are visible to
> my plugins (via Equinox's default parent-first boot delegation mechanism). While this works at
> runtime (when I handcraft a bundle), I am having trouble trying to create(export) the bundle from
> PDE - the wizard produces several errors (and rightly so!) "The import <foo> cannot be resolved".
>
> How can I configure PDE to indicate the Jars loading via system classpath, so that it can
> successfully generate/export a valid bundle Jar ?
>
> Regards,
> Subbarao
>
>
Re: Problem exporting plugins from PDE [message #89191 is a reply to message #89148] Fri, 01 June 2007 08:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

The answer is not to have Jars on the system classpath :-)

You can convert the Jars to bundles yourself, or you can use Peter's '<a href="http://www.aqute.biz/Code/Bnd">bnd</a>' tool which will do the same. Then everything's a bundle, and you don't need to worry any more.

NB You can also use a bundle as an ordinary Jar, so they can co-exist.

Alex.
Re: Problem exporting plugins from PDE [message #89328 is a reply to message #89148] Fri, 01 June 2007 14:14 Go to previous messageGo to next message
Andrew Niefer is currently offline Andrew NieferFriend
Messages: 990
Registered: July 2009
Senior Member
Subbarao,
There are a couple of properties you can set in your bundle's build.properties
file to add extra jars to the build-time classpath.

See
http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. pde.doc.user/reference/pde_feature_generating_build.htm
for extra.<library> and jars.extra.classpath properties.

-Andrew
Subbarao Meduri wrote:
> Greetings,
>
> I have a Equinox application that loads a few Jars on the system classpath (e.g., via "-classpath"
> option), and my application uses "osgi.parentClassLoader=app" so that these classes are visible to
> my plugins (via Equinox's default parent-first boot delegation mechanism). While this works at
> runtime (when I handcraft a bundle), I am having trouble trying to create(export) the bundle from
> PDE - the wizard produces several errors (and rightly so!) "The import <foo> cannot be resolved".
>
> How can I configure PDE to indicate the Jars loading via system classpath, so that it can
> successfully generate/export a valid bundle Jar ?
>
> Regards,
> Subbarao
>
>
Re: Problem exporting plugins from PDE [message #90523 is a reply to message #89148] Wed, 13 June 2007 19:37 Go to previous message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
Keep in mind that parent delegation changed in 3.3. Equinox 3.3 no
longer defaults to parent-first delegation. 3.3 does do parent-last
delegation by default instead of totally cutting you off from the parent
classloader cold turkey. But this can be disabled as well (and should
be for a fully compliant OSGi Framework).

The best solution for you moving forward is to add bundle metadata to
these jars and use them as real OSGi bundles *and* force bundles that
need packages from these jars to use either Import-Package or
Require-Bundle.

Pragmatically that may not be possible because your situation may
require you to support random jars on the classpath. To mimic this
behavior in PDE you could create a 'wrapper' PDE project which embeds
the jars into a bundle which is a fragment to the org.eclipse.osgi
bundle and exports the additional packages. This would still require
your other bundles to import the packages. You would also have to do
something at runtime to expose the random jars from the app classloader.
This is usually done by installing dummy framework fragments that only
contain the manifest metadata for exporting the additional packages and
setting osgi.frameworkParentClassloader=app so that the framework
classloader has access to the jars from the app classloader.

HTH

Tom
Previous Topic:Critical Problem with osgi console
Next Topic:Re: Can there be more than one application?
Goto Forum:
  


Current Time: Sat Apr 20 00:10:06 GMT 2024

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

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

Back to the top