just a hint on how optional imports are resolved :-)
AFAIK the framework resolves optional dependencies by the time the bundle is resolved. If a optional dependency is deployed later on it's not beeing resolved in the first bundle
importing it as optional :-)

regards, Achim


Am 24.08.2011 18:37, schrieb Harald Wellmann:
Somewhat weird, yes...

The OSGi spec is a little vague about the semantics of optional package resolution. It just states that a framework is free to ignore this dependency.

In my projects, I've also seen cases where a package imported with resolution:=optional did not resolve, but everything worked fine after removing the "optional" directive.

As a user, you would expect "optional" to mean "drop this if and only if there is no other way to satisfy all dependencies", whereas the spec seems to imply "the framework may drop this depencdency to make its life easier (and the user's life harder)".

I'm not familiar with the internals of Pax Exam 1.x. From what I've seen in Pax Exam 2.2.0, the problem should not occur, since the probes are built with "DynamicImport-Package: *" by default. I've never seen any optional resolutions.

Hope that helps,
Harald

Am 24.08.2011 16:18, schrieb Samuel Cox:
Hi,

I'm using Pax Exam1 in an attempt at testing OSGi services exposed in Fuse 4.3.

When I don't use TinyBundles, I get a NoClassDefFoundError with a
cause of ClassNotFoundException for a class representing my service
interface.  When I examine the probe's Import-Package header, I see
that it has the package providing this service listed as optional.
I've also printed out all the bundles and the services they provide.
The bundle providing the service starts successfully and the service
is listed.

If I use TinyBundle to alter the probe's Import-Package header such
that the resolution:=optional is removed from the package providing
the service, I don't get the NoClassDefFoundError.

Does this seem weird?


_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general


--
--
*Achim Nierbeck*


Apache Karaf<http://karaf.apache.org/>  Committer&  PMC
OPS4J Pax Web<http://wiki.ops4j.org/display/paxweb/Pax+Web/>    Committer&  
Project Lead
blog<http://notizblog.nierbeck.de/>


_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to