Hi,

The problem with legacy (or non-OSGi aware) libraries is, that the have
dependencies, which are not always needed, so they need not be resolved.
Contrast this with OSGi, where dependencies are always declared: Either
be an Import-Package or DynamicImport-Package statement or by the
dependency being contained in the bundle (there is also Require-Bundle,
but this has its issues and should be prevented).

If you build your bundle using the bundle plugin, your bundle contents
is scanned for all dependencies, which are turned into Import-Package
entries. Hence, when scanning the hibernate stuff, entries are created
for those hibernate packages.

You can come around this by either declaring the imports optional as in
   

<Import-Package>org.hibernate.loader.*;resolution:=optional,*</Import-Package

or as in


<DynamicImport-Package>org.hibernat.loader.*</DynamicImport-Package>

I prefer the former, as these optional dependencies are only tried to be
resolved at bundle resolution time, while the latter are evaluated
whenever a non-bound class is being accessed.

Hope this helps.

Regards
Felix

Am Freitag, den 30.11.2007, 04:20 -0800 schrieb Elvy:
> As a first step at migrating my current swing client App to OSGi, I thought
> of creating a massive bundle containing my whole application. Once done, I
> would start creating service interfaces and decouple my app little by
> little. Seems like a reasonable migration process to me...
> 
> I'm then trying to create this massive application bundle but keep on
> struggling with "unresolved packages"
> 
> here's the output of my shell :
> _________________________________________________________________________________
> -> ps
> START LEVEL 1
>    ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (1.0.1)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.0)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.0)
> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.0.0)
> [   8] [Installed  ] [    1] Tactical Editor Bundle (0.1.0.SNAPSHOT)
> -> stop 8
> -> start 8
> org.osgi.framework.BundleException: Unresolved package in bundle 8: package;
> (package=org.hibernate.loader.collection)
> -> stop 8
> _________________________________________________________________________________
> 
> If I'm not mistaken, the only dependency I use that includes some hibernate
> things is jbossall-client v4.2.0.GA. It does contain org.hibernate.loader,
> but there's only one class inside and not packages. Meanwhile, my manifest
> contains many references to packages inside org.hibernate.loader.
> 
> I would rather not specify all those dependencies as optional, I'd prefer to
> understand what the real issue is.
> 
> Have you ever experienced something like this?
> 
> 
> 
> 
> 
> -----
> Tell me something you don't know!


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

Reply via email to