简体   繁体   中英

OSGi bundle not started : missing requirement osgi.wiring.package; > &(osgi.wiring.package=org.apache.felix.dm)

I have been trying to follow 'Building Modular Cloud Apps with OSGi'. In chapter 3 of the book 'Creating the first OSGi application' the author describes how to create a simple OSGi application with a service in eclipse with bndtools.

Below is the screenshot of my classes and configurations.

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

The problem I am facing is

'! could not resolve the bundles: [agenda.service.simple-0.0.1Unresolved constraint in bundle agenda.service.simple [9]: Unable to resolve 9.0: missing requirement [9.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.felix.dm)(version>=3.0.0)(!(version>=4.0.0)))

] ! Failed to start bundle agenda.service.simple-0.0.1, exception Unresolved constraint in bundle agenda.service.simple [9]: Unable to resolve 9.0: missing requirement [9.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.felix.dm)(version>=3.0.0)(!(version>=4.0.0))) ____________________________'

Also, when i try to issue a command in the gogo shell that also doesnt input corretly sometimes. But eventually when it does the bundle status looks like

g! lb gogo: CommandNotFoundException: Command not found: b

g! lb gogo: CommandNotFoundException: Command not found: llb

g!

g!

g!

g!

g!

g!

lb START LEVEL 1 ID|State |Level|Name

 0|Active | 0|System Bundle (4.0.3) 1|Active | 1|Apache Felix Dependency Manager (4.0.1) 2|Active | 1|Apache Felix Dependency Manager Shell (4.0.1) 3|Active | 1|Apache Felix Gogo Command (0.14.0) 4|Active | 1|Apache Felix Gogo Runtime (0.10.0) 5|Active | 1|Apache Felix Gogo Runtime (0.12.1) 6|Active | 1|Apache Felix Gogo Shell (0.10.0) 7|Active | 1|osgi.cmpn (5.0.0.201305092017) 8|Active | 1|agenda.api (0.0.0.201505171119) 9|Installed | 1|agenda.service.simple (0.0.1) 

Your agenda.service.simple bundle is looking for a bundle that exports a version of org.apache.felix.dm between 3.0.0 and 4.0.0, but it is only finding the 4.0.1 version that the Apache Felix Dependency Manager exports.

Typically this would be caused by compiling against a different version of felix than you are running against.

Typically this would be caused by compiling against a different version of felix than you are running against.

True, this is likely to be caused by the fact that Bndtools selects the lowest version (in the specified version range) for buildpath dependencies and the highest version (in the specified version range) for runbundles.

In your case no ranges are specified so version org.apache.felix.dependencymanager version 3.1.0 will be used for the buildpath and 4.0.1 for running your application.

To use version version 4 of the dependency manager you can change the buildpath entry to:

org.apache.felix.dependencymanager;version='[4,5)'

Or to use version 3 at runtime you van change the -runbundles to

org.apache.felix.dependencymanager;version='[3,4)',\
org.apache.felix.dependencymanager.shell;version='[3,4)',\

I am also reading the book above. While trying to run the project, I had the same issue. This issue occurs because we manually provide dependency manager .jars to our project, which in turn conflicts with the version of .jar required for the project.

I did a new Eclipse setup in Advanced mode using Amdatu Blueprint and was able to get the running project. You can get the installation details in the link below:

http://amdatu-repo.s3.amazonaws.com/amdatu-blueprint/r1/docs/index.html#_install_eclipse

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM