首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Apache无法解析root:缺少需求-导致:无法解析java-api

Apache无法解析root:缺少需求-导致:无法解析java-api
EN

Stack Overflow用户
提问于 2020-10-06 10:41:37
回答 2查看 1.2K关注 0票数 0

Apache 4.0.1在Linux 7服务器上运行。

我得到以下错误:

代码语言:javascript
复制
org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=travellinck-osgi; type=karaf.feature; version="[1.0.4,1.0.4]"; filter:="(&(osgi.identity=travellinck-osgi)(type=karaf.feature)(version>=1.0.4)(version<=1.0.4))" [caused by: Unable to resolve travellinck-osgi/1.0.4: missing requirement [travellinck-osgi/1.0.4] osgi.identity; osgi.identity=com.travellinck.transIT.java-api; type=osgi.bundle; version="[1.153.0,1.153.0]"; resolution:=mandatory [caused by: Unable to resolve com.travellinck.transIT.java-api/1.153.0: missing requirement [com.travellinck.transIT.java-api/1.153.0] osgi.wiring.package; filter:="(&(osgi.wiring.package=javax.jws)(version>=1.1.0)(!(version>=2.0.0)))"]]
    at org.apache.felix.resolver.Candidates.populateResource(Candidates.java:314)[org.apache.felix.framework-5.0.1.jar:] 

有什么想法吗?

我是apache/OSGi的新手,所以如果这个问题中缺少相关信息,请原谅,我很乐意在建议时添加信息。

更多信息:

我用Java1.7使用maven构建它。我也尝试用Java8构建它,但是没有改变。

关于错误消息的这一部分:

代码语言:javascript
复制
caused by: Unable to resolve com.travellinck.transIT.java-api/1.153.0

在其中一个模块中,POM中有以下内容:

代码语言:javascript
复制
<modelVersion>4.0.0</modelVersion>
<groupId>com.travellinck.integration.vocabulary</groupId>
<artifactId>com.travellinck.transIT.java-api</artifactId>
<version>1.153.0</version>
<name>${bundle.name} ${project.version} [osgi]</name>
<packaging>bundle</packaging>
<description>Comprehensive travel services vocabulary</description>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-10-07 14:35:15

我通过从pom中删除这些依赖项来解决这个问题:

代码语言:javascript
复制
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.2.7</version>
    </dependency>
    <dependency>
        <groupId>javax.xml.ws</groupId>
        <artifactId>jaxws-api</artifactId>
        <version>2.2.7</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-ri</artifactId>
        <version>2.2.7</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>javax.jws</groupId>
        <artifactId>javax.jws-api</artifactId>
        <version>1.1</version>
    </dependency>
票数 0
EN

Stack Overflow用户

发布于 2020-10-14 20:19:27

在错误的结尾,它写着:“嘿,我错过了这个包: javax.jws,我想要的是>= 1.1版本,而不是2.0.0的更高版本。”

通过删除所有这些依赖项,您解决了这个问题。

代码语言:javascript
复制
<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.2.7</version>
</dependency>
<dependency>
    <groupId>javax.xml.ws</groupId>
    <artifactId>jaxws-api</artifactId>
    <version>2.2.7</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-ri</artifactId>
    <version>2.2.7</version>
    <type>pom</type>
</dependency>
<dependency>
    <groupId>javax.jws</groupId>
    <artifactId>javax.jws-api</artifactId>
    <version>1.1</version>
</dependency>

它为什么需要它?因为您确实使用了maven- bundle -plugin,所以在MANIFEST.MF中扫描依赖项并创建Import子句,其中列出了运行包所需的所有包。

如果你不需要的话,很好!但如果你最终需要他们,这不是问题!您只需确保包javax.jws与版本1.1一起安装即可。

我想这个包是由javax.jws-api导出的,它的名称类似,也在1.1版。因此,在您的karaf中,您可以执行bundle:install mvn:javax.jws/javax.jws-api/1.1,理论上,您的包现在将找到所需的包。

当然,您可以从maven central下载jar,并在其中签入META-INF/MANIFEST.MF,其中包含:

代码语言:javascript
复制
Export-Package: javax.jws;version="1.1.0",javax.jws.soap;version="1.1.0"

这意味着“我是1.1.0版javax.jws包的出口商”。如果您安装它,您的另一个包将能够找到该软件包。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64224161

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档