如何修复com.google.common.base的karaf依赖项错误

时间:2017-02-07 16:46:30

标签: java osgi apache-karaf

我尝试将.kar文件部署到具有一些依赖关系的karaf中。我收到这个错误:

2017-02-07 17:23:17,501 | ERROR | nsole user karaf | ShellUtil         | 74 - org.apache.karaf.shell.core - 4.0.5 | Exception caught while executing command org.apache.karaf.shell.support.MultiException: Error executing command on bundles:
                Error starting bundle 161: Unable to resolve de.dentrassi.camel.milo.camel-milo [161](R 161.0): missing requirement [de.dentrassi.camel.milo.camel-milo [161](R 161.0)] osgi.wiring.package; (&(osgi.wiring.package=com.google.common.base)(version>=19.0.0)(!(version>=20.0.0))) Unresolved requirements: [[de.dentrassi.camel.milo.camel-milo [161](R
161.0)] osgi.wiring.package; (&(osgi.wiring.package=com.google.common.base)(version>=19.0.0)(!(version>=20.0.0)))]
                at org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61)
                at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:69)[52:org.apache.karaf.bundle.core:4.0.5]
                at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:54)[52:org.apache.karaf.bundle.core:4.0.5]
                at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:83)[74:org.apache.karaf.shell.core:4.0.5]
                at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:67)[74:org.apache.karaf.shell.core:4.0.5]
                at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:87)[74:org.apache.karaf.shell.core:4.0.5]
                at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)[74:org.apache.karaf.shell.core:4.0.5]
                at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)[74:org.apache.karaf.shell.core:4.0.5]
                at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[74:org.apache.karaf.shell.core:4.0.5]
                at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)[74:org.apache.karaf.shell.core:4.0.5]
                at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)[74:org.apache.karaf.shell.core:4.0.5]
                at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)[74:org.apache.karaf.shell.core:4.0.5]
                at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:270)[74:org.apache.karaf.shell.core:4.0.5]
                at java.lang.Thread.run(Thread.java:745)[:1.8.0_121] Caused by: java.lang.Exception: Error starting bundle 161: Unable to resolve de.dentrassi.camel.milo.camel-milo [161](R 161.0): missing requirement [de.dentrassi.camel.milo.camel-milo [161](R 161.0)] osgi.wiring.package; (&(osgi.wiring.package=com.google.common.base)(version>=19.0.0)(!(version>=20.0.0))) Unresolved requirements: [[de.dentrassi.camel.milo.camel-milo [161](R
161.0)] osgi.wiring.package; (&(osgi.wiring.package=com.google.common.base)(version>=19.0.0)(!(version>=20.0.0)))]
                at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:66)[52:org.apache.karaf.bundle.core:4.0.5]
                ... 12 more

这没关系,但是这个包是guava的一部分,这是我部署的一部分。当我检查已安装的软件包时,我看到了

  

1 |有效| 50 | 19.0.0 |番石榴:   适用于Java的Google核心库

只有这与番石榴有关。所以不应该存在冲突的依赖。 我用

检查了番石榴束的导出
  

捆绑:标题1

得到了

Guava: Google Core Libraries for Java (1)
-----------------------------------------
Bnd-LastModified = 1449694703480
Build-Jdk = 1.7.0-google-v5
Built-By = cgdecker
Created-By = Apache Maven Bundle Plugin
Manifest-Version = 1.0
Tool = Bnd-1.50.0

Bundle-Description = Guava is a suite of core and expanded libraries that include    utility classes, google's collections, io classes, and much    much more.    Guava has only one code dependency - javax.annotation,    per the JSR-305 spec.
Bundle-DocURL = https://guava-libraries.googlecode.com/
Bundle-License = http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-ManifestVersion = 2
Bundle-Name = Guava: Google Core Libraries for Java
Bundle-SymbolicName = com.google.guava
Bundle-Version = 19.0.0

Export-Package = 
    com.google.common.net;
        uses:="javax.annotation,
            com.google.common.base,
            com.google.common.hash,
            com.google.common.io,
            com.google.common.primitives,
            com.google.common.collect,
            com.google.common.escape";
        version=19.0.0,

我用

查找了重复的导出
  

package:exports -d

但只有一些不相关的是重复的:

Package Name                                 | Version | Exporting bundles (ID)
-------------------------------------------------------------------------------
org.apache.camel.component.event             | 2.18.0  | 195 194
org.apache.camel.language.spel               | 2.18.0  | 195 194
org.apache.camel.spring.converter            | 2.18.0  | 195 194
org.apache.camel.spring.handler              | 2.18.0  | 195 194
org.apache.camel.spring.pollingconsumer      | 2.18.0  | 195 194
org.apache.camel.spring.processor.idempotent | 2.18.0  | 195 194
org.apache.camel.spring.remoting             | 2.18.0  | 195 194
org.apache.camel.spring.spi                  | 2.18.0  | 195 194
org.apache.camel.spring.util                 | 2.18.0  | 195 194
org.apache.camel.spring                      | 2.18.0  | 195 194
org.apache.camel.util.spring                 | 2.18.0  | 195 194

我被困在这里。你能给我一个如何调试的手吗?

编辑:我错误地用bundle:list查找番石榴。这省略了运行级别<所有捆绑包。我用la代替发现了两个捆绑: 番石榴18.0.0和番石榴19.0.0。有没有办法同时安装两个版本?

0 个答案:

没有答案