0

I have a bundle with the following mainfest:

Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: HelloCamera Bundle-SymbolicName: HelloCamera Bundle-Version: 1.0.0.qualifier Bundle-Activator: hellocamera.Activator Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: cameraservice, cameraserviceimpl, org.osgi.framework Layout: HelloCamera -> hellocamera -> Activator.java 

And a second bundle with this manifest:

Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: CameraService Bundle-SymbolicName: CameraService Bundle-Version: 1.0.0.qualifier Bundle-Localization: plugin Export-Package: cameraservice, cameraserviceimpl Import-Package: org.osgi.framework Bundle-Activator: cameraserviceimpl.Activator Layout: CameraService -> cameraservice -> CameraService.java -> cameraserviceimpl -> Activator.java -> CameraServiceImpl.java 

I can run the first bundle from Eclipse and everything works fine as expected. I then exported both bundles as a CameraService.jar and HelloCamera.jar respectivly

I opened up my OSGI console, java -jar equinox.jar -console and

osgi> install file:CameraService.jar osgi> install file:HelloCamera.jar osgi> ss id State Bundle 17 INSTALLED HelloCamera_1.0.0.qualifier 18 RESOLVED unknown_0.0.0 [18] 

then I get

The Bundle could not be resolved. Reason: Missing Constraint: Import-Package: cameraservice; version="0.0.0" 
9
  • What do you mean you exported both bundles as a jar? One jar, one bundle. Commented Sep 2, 2013 at 14:47
  • @chrylis i have tried exporting them together as one bundle and as two seperate bundles Commented Sep 2, 2013 at 14:48
  • Please post your manifest from the "two-jar" bundle. (By copying it out of the zip file, not from Eclipse.) Commented Sep 2, 2013 at 14:48
  • @chrylis how do i get the maifest from the jar file? Commented Sep 2, 2013 at 14:49
  • 1
    There's something very suspicious about the second bundle. Why would OSGi report it as "resolved" but not know the name of it? I think probably the JAR file is corrupt or the manifest is invalid. Commented Sep 2, 2013 at 15:44

1 Answer 1

1

After searching,

I found the problem was with the manifest files. When exporting the jars in my settings I said use the manifest file already in the folder.

I never looked at what the path was pointing to (assuming eclipse would set it correctly) however Eclipse hadn't changed its location so both jars were using the same Manifest file.

Lesson learned. Always check the form before blindly pressing finish.

Sign up to request clarification or add additional context in comments.

1 Comment

It sounds like you're building your bundles in very manual and error-prone way. Why not look into using proper tooling, like bnd and Bndtools?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.