JDK/JRE packages not exported by OSGi system bundle [message #734253] |
Fri, 07 October 2011 09:11 |
Piotr Messages: 6 Registered: July 2009 |
Junior Member |
|
|
Hello,
I guess the topic might appear from time to time, although I've spent two days searching for answer on Google and found some articles, which explain the problem, but I can't find working solution. Maybe you guys will be able to give me good answer.
Recently I introduced org.apache.servicemix.bundles.dom4j-1.6.1_4.jar bundle in order to have access to dom4j implementation. This bundle contains package org.dom4j.io, which defines usage of javax.xml.stream, javax.xml.stream.event and javax.xml.stream.util - unfortunately it imports those packages using version range - which is [1.0, 2).
As we know JRE 1.6 contains those packages, and according to "JavaSE-1.6.profile" file in org.eclipse.osgi bundle, this package should be exported by system bundle. Even though I defined everywhere "Bundle-RequiredExecutionEnvironment: JavaSE-1.6" in my MANIFEST.MF files, when on the launcher page I do "validate dependencies" I still get information, that dom4j bundle can't be resolved because javax.xml.stream* packages can't be found. I guess this is because system bundle exports them as version 0.0.0.
What can be my solution to this problem? Temporarily I edited manifest of dom4j bundle and I removed version constrains, so that every version is accepted. Unfortunately this is not desirable fix, because this isn't our bundle, and we would prefer to use it out of the box, without the need to change it's manifest.
There's additional problem like this. One of our other bundles (also provided by 3rd party) is woodstox-core-asl-4.1.1.jar, which in turn declares Import-package: javax.xml.stream;version="0.0.0" - this also isn't resolved against the JRE's package exported by system bundle - the difference is that it doesn't resolve in the launcher validation, but if I ignore the message, it will be wired to correct package in the running OSGi application.
Please note that the application we build is based on Eclipse RCP 3.6.2 - this is a desktop application. My IDE is Eclipse 3.7.1, we use JDK 1.6_20.
Can you please provide any ideas how to resolve my issues? Thank you in advance.
|
|
|
|
Re: JDK/JRE packages not exported by OSGi system bundle [message #734313 is a reply to message #734311] |
Fri, 07 October 2011 12:43 |
Piotr Messages: 6 Registered: July 2009 |
Junior Member |
|
|
Hi,
thank you for your answer. I tried the "org.osgi.framework.system.packages.extra" VM argument yesterday. It is not perfect solution but it works. Still, the launcher validator won't pick it, so you'll always have dependency validation errors in the dialog.
When you start the application using e.g. "org.osgi.framework.system.packages.extra=javax.xml.stream; version=1.0.0" option the problem in the running application disappears, but if you type in OSGi console "packages javax.xml.stream" you'll see, that there are now two providers of this package:
1) javax.xml.stream (0.0.0) <org.eclipse.osgi>
2) javax.xml.stream (1.0.0) <org.eclipse.osgi>
Normally that would be a problem - having two "providers" of the package, I guess, but since the provider is the same bundle (the system bundle) I hope that the classloader is also the same, that's why it works.
From the bug you pointed me to, I see that for the time being there's no hope to resolve the problem with the launcher dialog...
[Updated on: Fri, 07 October 2011 12:43] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02819 seconds