从Felix shell启动OSGI包:未解决的约束

时间:2015-04-19 19:15:20

标签: java osgi bundle apache-felix

我试图用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>

这是命令shell中的错误:

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))
->

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

1 个答案:

答案 0 :(得分:2)

您正在尝试启动捆绑包#4,因为错误显示取决于导出 org.osgi.service.cm 版本&gt; = 1.2.0的外部捆绑包,您不需要&#39;把它放在你的清单中。

奇怪的是,我在你的pom.xml中没有看到任何import-package语句,顺便说一下,该bundle是 Felix配置管理服务,安装它,如果没有& #39; t其他缺少的依赖关系应该正确启动。