eclipse OSGi 包未启动:缺少要求 osgi.wiring.package;> &(osgi.wiring.package=org.apache.felix.dm)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30286459/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
OSGi bundle not started : missing requirement osgi.wiring.package; > &(osgi.wiring.package=org.apache.felix.dm)
提问by mu_sa
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.
我一直在尝试遵循“使用 OSGi 构建模块化云应用程序”。在“创建第一个 OSGi 应用程序”一书的第 3 章中,作者描述了如何使用 bndtools 在 Eclipse 中创建一个带有服务的简单 OSGi 应用程序。
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))) ____________________________'
'!无法解析包:[agenda.service.simple-0.0.1Unresolved 约束包中的议程.service.simple [9]:无法解析 9.0:缺少需求 [9.0] osgi.wiring.package;(&(osgi.wiring.package=org.apache.felix.dm)(version>=3.0.0)(!(version>=4.0.0)))
]!无法启动捆绑议程.service.simple-0.0.1,捆绑议程.service.simple [9]中的异常未解决约束:无法解决9.0:缺少需求[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
此外,当我尝试在 gogo shell 中发出一个命令时,该命令有时也不会正确输入。但最终当它完成时,捆绑状态看起来像
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)
G!lb gogo:CommandNotFoundException:未找到命令:b
G!lb gogo:CommandNotFoundException:找不到命令: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)
采纳答案by AndyL
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.
您的议程.service.simple 包正在寻找一个导出 org.apache.felix.dm 版本介于 3.0.0 和 4.0.0 之间的包,但它只找到了 Apache Felix Dependency Manager 导出的 4.0.1 版本.
Typically this would be caused by compiling against a different version of felix than you are running against.
通常,这可能是由于针对与您正在运行的 felix 版本不同的版本进行编译造成的。
回答by Bram Pouwelse
Typically this would be caused by compiling against a different version of felix than you are running against.
通常,这可能是由于针对与您正在运行的 felix 版本不同的版本进行编译造成的。
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.
确实,这很可能是由于 Bndtools 为 buildpath 依赖项选择最低版本(在指定版本范围内)和为 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.
在您的情况下,没有指定范围,因此版本 org.apache.felix.dependencymanager 3.1.0 版将用于构建路径,4.0.1 版将用于运行您的应用程序。
To use version version 4 of the dependency manager you can change the buildpath entry to:
要使用依赖管理器的第 4 版,您可以将 buildpath 条目更改为:
org.apache.felix.dependencymanager;version='[4,5)'
Or to use version 3 at runtime you van change the -runbundles to
或者要在运行时使用版本 3,您将 -runbundles 更改为
org.apache.felix.dependencymanager;version='[3,4)',\
org.apache.felix.dependencymanager.shell;version='[3,4)',\
回答by abhinav3414
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.
我也在看上面的书。在尝试运行该项目时,我遇到了同样的问题。出现此问题是因为我们手动提供dependency manager .jars
给我们的项目,这又与.jar
项目所需的版本冲突。
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:
我使用 Amdatu Blueprint 在高级模式下进行了新的 Eclipse 设置,并且能够获得正在运行的项目。您可以在以下链接中获取安装详细信息:
http://amdatu-repo.s3.amazonaws.com/amdatu-blueprint/r1/docs/index.html#_install_eclipse
http://amdatu-repo.s3.amazonaws.com/amdatu-blueprint/r1/docs/index.html#_install_eclipse