【问题标题】:Start OSGI bundle from Felix shell: Unresolved constraint从 Felix shell 启动 OSGI 包:未解决的约束
【发布时间】:2015-04-19 19:15:20
【问题描述】:

我正在尝试使用 felix 执行 OSGI 包。但是,我什至无法启动捆绑包。我的 shell 命令出错了。

这是包的 pom.xml:

<project>
  <modelVersion>4.0.0</modelVersion>
  <packaging>bundle</packaging>
  <groupId>gateway</groupId>
  <artifactId>home.interfaces</artifactId>
  <version>1.0.0</version>
  <name>Interface Service Provider</name>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.0.1</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>
              ${pom.artifactId}
            </Bundle-SymbolicName>
        <Export-Package>
                 temp;pres
            </Export-Package>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-ipojo-plugin</artifactId>
        <version>1.6.0</version>
        <executions>
          <execution>
            <goals>
              <goal>ipojo-bundle</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

这是命令外壳中的错误:

Welcome to Felix
================

-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (2.0.4)
[   1] [Active     ] [    1] Apache Felix Bundle Repository (1.4.3)
[   2] [Active     ] [    1] Apache Felix Shell Service (1.4.2)
[   3] [Active     ] [    1] Apache Felix Shell TUI (1.4.1)
[   4] [Installed  ] [    1] Interface Service Provider (1.0.0)
[   5] [Installed  ] [    1] Presence Service Provider (1.0.0)
[   6] [Installed  ] [    1] Temperature Service Provider (1.0.0)
[   7] [Installed  ] [    1] Analyser Service (1.0.0)
-> start 4
org.osgi.framework.BundleException: Unresolved constraint in bundle home.interfa
ces [4]: package; (&(package=org.osgi.service.cm)(version>=1.2.0))
->

这是什么错误,我该如何解决?

【问题讨论】:

    标签: java osgi bundle apache-felix


    【解决方案1】:

    您正在尝试启动捆绑包 #4,如错误所示,该捆绑包依赖于导出 org.osgi.service.cm 且版本>=1.2.0 的外部捆绑包,但您没有它在你的列表中。

    奇怪的是我在你的 pom.xml 中没有看到任何 import-package 语句,顺便说一句,那个包是 Felix 配置管理服务,安装它,如果没有其他缺少的依赖项应该可以正确启动。

    【讨论】:

    • 我安装 org.apache.felix.configadmin.jar 版本 1.2.0 和安装 org.apache.felix.ipojo 版本 1.6.0 并且它可以工作:D
    猜你喜欢
    • 2014-03-18
    • 2015-04-28
    • 2015-05-29
    • 2013-10-22
    • 2011-03-14
    • 2011-06-19
    • 2018-06-21
    • 2014-01-13
    • 2018-07-21
    相关资源
    最近更新 更多