OSGi bundle not started : missing requirement osgi.wiring.package; > &(osgi.wiring.package=org.apache.felix.dm)
我一直在尝试遵循"使用OSGi构建模块化云应用程序"。 在"创建第一个OSGi应用程序"这本书的第3章中,作者描述了如何使用bndtools在eclipse中使用服务创建一个简单的OSGi应用程序。
下面是我的类和配置的屏幕截图。
我面临的问题是
'! 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)))
____________________________'
另外,当我尝试在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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 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)
Typically this would be caused by compiling against a different version of felix than you are running against.
的确,这很可能是由于Bndtools为构建路径依赖项选择了最低版本(在指定版本范围内),为runbundle选择了最高版本(在指定版本范围内)。
在您的情况下,未指定范围,因此版本org.apache.felix.dependencymanager版本3.1.0将用于构建路径,版本4.0.1将用于运行应用程序。
要使用版本4的依赖项管理器,可以将buildpath条目更改为:
1 | org.apache.felix.dependencymanager;version='[4,5)' |
或者要在运行时使用版本3,可以将-runbundles更改为
1 2 | org.apache.felix.dependencymanager;version='[3,4)',\\ org.apache.felix.dependencymanager.shell;version='[3,4)',\\ |
您的议程.service.simple捆绑包正在寻找一个捆绑包,该捆绑包可以导出3.0.0到4.0.0之间的org.apache.felix.dm版本,但是只能找到Apache Felix Dependency Manager导出的4.0.1版本。 。
通常,这可能是由于与您运行的felix版本不同而导致的。
我也在读上面的书。在尝试运行该项目时,我遇到了同样的问题。发生此问题的原因是,我们为项目手动提供了
我使用Amdatu Blueprint在"高级"模式下进行了新的Eclipse设置,并且能够获取正在运行的项目。
您可以在下面的链接中获取安装详细信息:
http://amdatu-repo.s3.amazonaws.com/amdatu-blueprint/r1/docs/index.html#_install_eclipse