捆绑OSGI导入包中未解决的约束缺少版本号无法导入捆绑包

时间:2018-04-18 17:06:49

标签: osgi apache-karaf osgi-bundle

提前谢谢。我有问题启动osgi包它给出了这个错误消息: 软件包/软件包将无法安装。它编译并构建好,当部署到Karaf时,它将无法加载并抱怨丢失的布线包看起来像是正在导出和导入。但缺少版本ID。

执行命令时出错:无法启动软件包mvn:com.ge.digital.passthru / passthrumt1.dataserviceimpl / 1.0.1-SNAPSHOT in feature(s)passthru-mt1-application-1.0.1-SNAPSHOT:未解决的约束bundle passthrumt1.dataserviceimpl [298]:无法解析298.0:缺少需求[298.0] osgi.wiring.package; (osgi.wiring.package = com.ge.digital.passthru.dataservice)

Manifest显示它正在导入包,并且它正在导出,我唯一能想到的是导入包没有版本号。这可能是我的问题吗?任何想法如何解决?

Manifest-Version: 1.0
Bnd-LastModified: 1524070286656
Build-Jdk: 1.8.0_91
Built-By: 212555427
Bundle-ManifestVersion: 2
Bundle-Name: PassThru MT1 :: Data Service Impl
Bundle-SymbolicName: passthrumt1.dataserviceimpl
Bundle-Version: 1.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Service: com.ge.digital.passthru.dataservice.PDXDataService
Import-Package: com.ge.digital.passthru.dataservice,com.ge.digital.passt
 hru.entities;version="[1.0,2)",com.ge.digital.passtrhu.dataservice;vers
 ion="[1.0,2)",org.apache.camel;version="[2.17,3)",org.apache.camel.buil
 der;version="[2.17,3)",org.apache.camel.component.file;version="[2.17,3
 )",org.apache.camel.model;version="[2.17,3)",org.osgi.service.blueprint
 ;version="[1.0.0,2.0.0)",org.slf4j;version="[1.7,2)"
Tool: Bnd-1.50.0

这是我的POM   

<!-- GE Internal Dependencies -->
<dependency>
  <groupId>com.ge.digital.passthru</groupId>
  <artifactId>passthrumt1.dataservice</artifactId>
  <version>${project.version}</version>
</dependency>
<dependency>
  <groupId>com.ge.digital.passthru</groupId>
  <artifactId>passthrumt1.entities</artifactId>
  <version>${project.version}</version>
</dependency>

<!-- Fuse Dependencies -->
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-core</artifactId>
</dependency>
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-blueprint</artifactId>
</dependency>
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-ftp</artifactId>
</dependency>

<!-- logging -->
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>jcl-over-slf4j</artifactId>
</dependency>
<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
</dependency>

<plugins>

  <!-- to generate the MANIFEST-FILE of the bundle -->
  <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>${bundle-plugin-version}</version>
    <extensions>true</extensions>
    <configuration>
      <instructions>
        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
        <Private-Package>com.ge.digital.passthru.dataservice.impl.*</Private-Package>
        <Import-Package>
        com.ge.digital.passtrhu.dataservice,
        com.ge.digital.passthru.entities,
        *
        </Import-Package>
      </instructions>
    </configuration>
  </plugin>

</plugins>

1 个答案:

答案 0 :(得分:0)

我想这可以追溯到使用fuse的旧maven repo刷新东西,你需要删除.m2 / repository / xxx目录和fusehome / data目录内容并重新开始。这让我的问题消失了。感谢大家。希望这可以帮助。

现在一切看起来都不错。

    PassThru MT1 :: Data Service (297)
    ----------------------------------
    Created-By = Apache Maven Bundle Plugin
    Manifest-Version = 1.0
    Bnd-LastModified = 1524090455529
    Build-Jdk = 1.8.0_91
    Built-By = NSK1212555427A$
    Tool = Bnd-1.50.0

Bundle-ManifestVersion = 2
Bundle-SymbolicName = passthrumt1.dataservice
Bundle-Version = 1.0.1.SNAPSHOT
Bundle-Name = PassThru MT1 :: Data Service

Export-Package =
        com.ge.digital.passthru.dataservice;uses:=com.ge.digital.passthru.entities;version=1.0.1.SNAPSHOT
Import-Package =
        com.ge.digital.passthru.entities;version="[1.0,2)"


JBossFuse:admin@FLEET TEST ENV> headers 298

PassThru MT1 :: Data Service Impl (298)
---------------------------------------
Created-By = Apache Maven Bundle Plugin
Manifest-Version = 1.0
Bnd-LastModified = 1524090458281
Build-Jdk = 1.8.0_91
Built-By = NSK1212555427A$
Tool = Bnd-1.50.0

Bundle-ManifestVersion = 2
Bundle-SymbolicName = passthrumt1.dataserviceimpl
Bundle-Version = 1.0.1.SNAPSHOT
Bundle-Name = PassThru MT1 :: Data Service Impl

Export-Service =
        com.ge.digital.passthru.dataservice.PDXDataService

Import-Package =
        com.ge.digital.passthru.dataservice;version="[1.0,2)",
        com.ge.digital.passthru.entities;version="[1.0,2)",
        org.apache.camel;version="[2.17,3)",
        org.apache.camel.builder;version="[2.17,3)",
        org.apache.camel.component.file;version="[2.17,3)",
        org.apache.camel.model;version="[2.17,3)",
        org.osgi.service.blueprint;version="[1.0.0,2.0.0)",
        org.slf4j;version="[1.7,2)"