0

I want to convert a Maven2 project in a OSGI bundle. I am trying to use maven-bundle-plugin that should create the manifest according to maven dependencies. The problem is that i can't manage to let it work. When I install and run the bundle generated, there is always an error like:

org.osgi.framework.BundleException: The bundle "My_OSGI_Bundle" could not be resolved. Reason: Missing Constraint: Import-Package: com.sun.javadoc;

Each time I add manually the missing constraint among the of the maven-bundle-plugin. But there is always another missing constraint. Now I'm stuck on com.sun.javadoc that I can't add in any way. Anyway... I can't add all the packages manually! Have you any better idea, please? Thank you

===UPDATE===

without adding anything in the export tag, the first error the run of bundle gives to me is:

org.osgi.framework.BundleException: The bundle "Partes_0.1.0.SNAPSHOT [55]" could not be resolved. 
Reason:Missing Constraint: Import-Package: com.eviware.soapui.config; version="0.0.0" at
org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1327) at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1311) at ..
DeLac
  • 1,068
  • 13
  • 43

1 Answers1

0

This error means that something inside your bundle depends on com.sun.javadoc, e.g. as a direct result of using that API from your code. You need to find a bundle that exports that API.

You might now state that you don't actually use com.sun.javadoc. I believe you have probably dragged in a whole load of extra third-party dependencies into your bundle... the phrase "each time I manually added the missing constraint" sets off alarm bells! So the dependency probably exists in something that shouldn't be in your bundle at all.

The best thing to do is go back to the beginning before you started adding random bits to your bundle in an attempt to make the problem go away. That is, make sure your bundle only contains your code. Then find out what the missing import is, and find a bundle that exports it.

Neil Bartlett
  • 23,743
  • 4
  • 44
  • 77
  • when I said "each time i add manually.." I mean, each time i have an error "missing constraint x.y.z", I manually add it in the export tag of maven-bundle-plugin. – DeLac Jul 02 '13 at 16:02
  • Yes that's the problem. Don't do that! – Neil Bartlett Jul 02 '13 at 16:15
  • and so... What shall I do? I need in the code the package x.y.z, it's also in the generated jar, but at the start of the bundle it gives the _"missing constraint x.y.z"_ error – DeLac Jul 02 '13 at 16:44
  • If I knew what x.y.z was then I could possibly help you find a bundle that exports it. – Neil Bartlett Jul 03 '13 at 06:50
  • it's the **com.eviware.soapui.config**. I updated the question with this info. – DeLac Jul 03 '13 at 09:02