OSGi包未启动:缺少要求osgi.wiring.package; >及(osgi.wiring.package = org.apache.felix.dm)

时间:2015-05-17 11:31:45

标签: java eclipse osgi apache-felix bndtools

我一直在尝试使用OSGi'来构建模块化云应用程序。在本书的第3章'创建第一个OSGi应用程序'作者描述了如何使用bndtools在eclipse中创建一个带有服务的简单OSGi应用程序。

以下是我的课程和配置的截图。

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

我面临的问题是

  

&#39 ;!无法解决捆绑:   [agenda.servvice.simple-0.0.1未解决束中的约束   agenda.service.simple [9]:无法解决9.0:缺少要求   [9.0] osgi.wiring.package;   (及(osgi.wiring.package = org.apache.felix.dm)(版本> = 3.0.0)((版本>!= 4.0.0)))

     

]!无法启动bundle agenda.service.simple-0.0.1,异常   bundle.service.simple [9]中未解决的约束:无法执行   解析9.0:缺少要求[9.0] osgi.wiring.package;   (及(osgi.wiring.package = org.apache.felix.dm)(版本> = 3.0.0)((版本>!= 4.0.0)))   ____________________________'

此外,当我尝试在gogo shell中发出一个命令时,有时也没有正确输入。但最终当它的捆绑状态看起来像

  

克! lb gogo:CommandNotFoundException:找不到命令:b

     

克! lb gogo:CommandNotFoundException:找不到命令:llb

     

克!

     

克!

     

克!

     

克!

     

克!

     

克!

     

lb START LEVEL 1 ID |州|级别|姓名

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)

3 个答案:

答案 0 :(得分:1)

您的agenda.service.simple软件包正在寻找一个在3.0.0和4.0.0之间导出org.apache.felix.dm版本的软件包,但它只找到Apache Felix的4.0.1版本Dependency Manager导出。

通常,这可能是因为针对不同版本的felix进行编译而导致的。

答案 1 :(得分:0)

  

通常,这可能是因为针对不同版本的felix进行编译而导致的。

确实,这很可能是因为Bndtools为构建路径依赖项选择了最低版本(在指定的版本范围内),为运行捆绑包选择了最高版本(在指定的版本范围内)。

在您的情况下,没有指定范围,因此版本org.apache.felix.dependencymanager版本3.1.0将用于构建路径,4.0.1用于运行应用程序。

要使用依赖关系管理器的版本4,您可以将buildpath条目更改为:

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

或者在运行时使用版本3,您可以将-runbundles更改为

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

答案 2 :(得分:0)

我也在阅读上面的那本书。在尝试运行该项目时,我遇到了同样的问题。出现此问题的原因是我们手动向项目提供dependency manager .jars,而项目又与项目所需的.jar版本冲突。

我使用Amdatu Blueprint在高级模式下进行了新的Eclipse设置,并且能够获得正在运行的项目。 您可以在以下链接中获取安装详细信息:

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

相关问题