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

Java 如何修复com.google.common.base的karaf依赖项错误,java,osgi,apache-karaf,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 e

我尝试将一个.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 |番石榴: Google Java核心库

只有这与番石榴有关。因此,不应该存在相互冲突的依赖关系。 我和他一起检查了番石榴包的出口情况

包:头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,
我寻找重复的出口与

包装:出口-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查找番石榴时出错了。这将忽略运行级别<50的所有bundle。我改用la,发现了两个捆绑包:
番石榴18.0.0和番石榴19.0.0。有没有办法同时安装两个版本?

注意:堆栈后跟踪是作为代码(缩进4),而不是块引号(行以
开头)。除非用单空格字体打印,否则它们基本上是不可读的。对不起,我应该知道的。修复了这个问题。注意:堆栈后跟踪作为代码(缩进4),而不是块引号(行以
开头)。除非用单空格字体打印,否则它们基本上是不可读的。对不起,我应该知道的。修正了。