应用程序Guava lib版本与Quarkus版本冲突

时间:2019-07-31 16:14:51

标签: quarkus

在通过第三方lib在我的Quarkus(0.19.1)应用程序中包括不太最新版本的Guava(20.0)时,在运行时(mvn compile quarkus:dev),出现以下异常:< / p>

java.lang.NoSuchMethodError: com.google.common.net.HostAndPort.getHostText()Ljava/lang/String;

升级到lib的最新快照可以解决此问题,因为Guava的版本也已升级。但这不是理想的解决方案,因为该版本的lib尚未发布。此外,那里有依赖于Guava(位于Quarkus内部使用的另一个lib上)的库,这些库可能永远不会更新。

是否有一种方法可以将Quarkus使用的Guava库(或任何其他库)与应用程序所使用的库分开?

修改 一些更多的细节。该问题与org.littleshoot:littleproxy 1.1.2(https://github.com/adamfisk/LittleProxy/blob/littleproxy-1.1.2/pom.xml)有关,该文件依赖于com.google.guava:guava 20.0

依赖项树检查显示使用com.google.guava:guava 27.0.1-jre 而不是20.0版本。


[INFO] +- io.quarkus:quarkus-resteasy:jar:0.19.1:compile
[INFO] |  +- io.quarkus:quarkus-undertow:jar:0.19.1:compile
[INFO] |  |  +- io.quarkus:quarkus-arc:jar:0.19.1:compile
[INFO] |  |  |  \- io.quarkus.arc:arc:jar:0.19.1:compile
[INFO] |  |  +- io.undertow:undertow-servlet:jar:2.0.21.Final:compile
[INFO] |  |  |  +- io.undertow:undertow-core:jar:2.0.21.Final:compile
[INFO] |  |  |  \- org.jboss.spec.javax.servlet:jboss-servlet-api_4.0_spec:jar:1.0.0.Final:compile
[INFO] |  |  +- org.jboss.xnio:xnio-nio:jar:3.7.2.Final:compile
[INFO] |  |  +- org.jboss.xnio:xnio-api:jar:3.7.2.Final:compile
[INFO] |  |  \- org.eclipse.microprofile.context-propagation:microprofile-context-propagation-api:jar:1.0-RC1:compile
[INFO] |  |     \- javax.enterprise:cdi-api:jar:2.0.SP1:compile
[INFO] |  |        +- javax.el:javax.el-api:jar:3.0.0:compile
[INFO] |  |        \- javax.interceptor:javax.interceptor-api:jar:1.2:compile
[INFO] |  \- io.quarkus:quarkus-resteasy-server-common:jar:0.19.1:compile
[INFO] |     +- io.quarkus:quarkus-resteasy-common:jar:0.19.1:compile
[INFO] |     |  +- org.jboss.resteasy:resteasy-core:jar:4.1.0.Final:compile
[INFO] |     |  |  +- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.1_spec:jar:1.0.2.Final:compile
[INFO] |     |  |  +- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.3_spec:jar:1.0.1.Final:compile
[INFO] |     |  |  +- org.jboss.resteasy:resteasy-core-spi:jar:4.1.0.Final:compile
[INFO] |     |  |  \- org.reactivestreams:reactive-streams:jar:1.0.2:compile
[INFO] |     |  +- org.jboss.resteasy:resteasy-context-propagation:jar:4.1.0.Final:compile
[INFO] |     |  |  \- io.smallrye:smallrye-context-propagation:jar:1.0.7:compile
[INFO] |     |  |     \- io.smallrye:smallrye-context-propagation-api:jar:1.0.7:compile
[INFO] |     |  \- com.sun.activation:jakarta.activation:jar:1.2.1:compile
[INFO] |     +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] |     \- io.quarkus:quarkus-jaxb:jar:0.19.1:compile
[INFO] +- io.quarkus:quarkus-resteasy-jsonb:jar:0.19.1:compile
[INFO] |  +- io.quarkus:quarkus-jsonb:jar:0.19.1:compile
[INFO] |  |  +- org.eclipse:yasson:jar:1.0.4:compile
[INFO] |  |  +- javax.json.bind:javax.json.bind-api:jar:1.0:compile
[INFO] |  |  \- io.quarkus:quarkus-jsonp:jar:0.19.1:compile
[INFO] |  +- org.jboss.resteasy:resteasy-json-binding-provider:jar:4.1.0.Final:compile
[INFO] |  |  +- org.glassfish:javax.json:jar:1.1.4:compile
[INFO] |  |  \- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-json-p-provider:jar:4.1.0.Final:compile
[INFO] |  \- commons-io:commons-io:jar:2.5:compile
[INFO] +- org.littleshoot:littleproxy:jar:1.1.2:compile
[INFO] |  +- com.google.guava:guava:jar:27.0.1-jre:compile
[INFO] |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  |  +- org.checkerframework:checker-qual:jar:2.5.2:compile
[INFO] |  |  +- com.google.errorprone:error_prone_annotations:jar:2.2.0:compile
[INFO] |  |  +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] |  |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.17:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.8.1:compile
[INFO] |  +- io.netty:netty-all:jar:4.1.34.Final:compile
[INFO] |  +- com.barchart.udt:barchart-udt-bundle:jar:2.3.0:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- io.quarkus:quarkus-junit5:jar:0.19.1:test
[INFO] |  +- io.quarkus:quarkus-bootstrap-core:jar:0.19.1:test
[INFO] |  |  +- org.apache.maven:maven-embedder:jar:3.5.4:test
[INFO] |  |  |  +- org.apache.maven:maven-settings:jar:3.5.4:test
[INFO] |  |  |  +- org.apache.maven:maven-core:jar:3.5.4:test
[INFO] |  |  |  |  \- org.apache.maven:maven-artifact:jar:3.5.4:test
[INFO] |  |  |  +- org.apache.maven:maven-plugin-api:jar:3.5.4:test
[INFO] |  |  |  +- org.apache.maven:maven-model:jar:3.5.4:test
[INFO] |  |  |  +- org.apache.maven:maven-model-builder:jar:3.5.4:test
[INFO] |  |  |  +- org.apache.maven:maven-builder-support:jar:3.5.4:test
[INFO] |  |  |  +- org.apache.maven.resolver:maven-resolver-api:jar:1.1.1:test
[INFO] |  |  |  +- org.apache.maven.resolver:maven-resolver-util:jar:1.1.1:test
[INFO] |  |  |  +- org.apache.maven.shared:maven-shared-utils:jar:3.2.1:test
[INFO] |  |  |  +- com.google.inject:guice:jar:no_aop:4.2.0:test
[INFO] |  |  |  |  \- aopalliance:aopalliance:jar:1.0:test
[INFO] |  |  |  +- javax.annotation:jsr250-api:jar:1.0:test
[INFO] |  |  |  +- org.codehaus.plexus:plexus-utils:jar:3.0.24:test
[INFO] |  |  |  +- org.codehaus.plexus:plexus-classworlds:jar:2.5.2:test
[INFO] |  |  |  +- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.3:test
[INFO] |  |  |  +- org.codehaus.plexus:plexus-component-annotations:jar:1.7.1:test
[INFO] |  |  |  \- commons-cli:commons-cli:jar:1.4:test
[INFO] |  |  +- org.apache.maven:maven-settings-builder:jar:3.5.4:test
[INFO] |  |  |  +- org.codehaus.plexus:plexus-interpolation:jar:1.24:test
[INFO] |  |  |  \- org.sonatype.plexus:plexus-sec-dispatcher:jar:1.4:test
[INFO] |  |  |     \- org.sonatype.plexus:plexus-cipher:jar:1.4:test
[INFO] |  |  +- org.apache.maven:maven-resolver-provider:jar:3.5.4:test
[INFO] |  |  |  +- org.apache.maven:maven-repository-metadata:jar:3.5.4:test
[INFO] |  |  |  +- org.apache.maven.resolver:maven-resolver-spi:jar:1.1.1:test
[INFO] |  |  |  \- org.apache.maven.resolver:maven-resolver-impl:jar:1.1.1:test
[INFO] |  |  +- org.apache.maven.resolver:maven-resolver-connector-basic:jar:1.1.1:test
[INFO] |  |  +- org.apache.maven.resolver:maven-resolver-transport-file:jar:1.1.1:test
[INFO] |  |  \- org.apache.maven.resolver:maven-resolver-transport-http:jar:1.1.1:test
[INFO] |  |     \- org.slf4j:jcl-over-slf4j:jar:1.7.25:test
[INFO] |  +- io.quarkus:quarkus-test-common:jar:0.19.1:test
[INFO] |  |  +- io.quarkus:quarkus-core-deployment:jar:0.19.1:test
[INFO] |  |  |  +- commons-beanutils:commons-beanutils:jar:1.9.3:test
[INFO] |  |  |  |  \- commons-collections:commons-collections:jar:3.2.2:test
[INFO] |  |  |  +- org.jboss.invocation:jboss-invocation:jar:1.5.2.Final:test
[INFO] |  |  |  +- org.jboss.classfilewriter:jboss-classfilewriter:jar:1.2.4.Final:test
[INFO] |  |  |  +- io.quarkus.gizmo:gizmo:jar:1.0.0.Alpha5:test
[INFO] |  |  |  |  \- org.ow2.asm:asm-util:jar:7.1:test
[INFO] |  |  |  |     +- org.ow2.asm:asm-tree:jar:7.1:test
[INFO] |  |  |  |     \- org.ow2.asm:asm-analysis:jar:7.1:test
[INFO] |  |  |  +- org.ow2.asm:asm:jar:7.1:test
[INFO] |  |  |  \- io.quarkus:quarkus-builder:jar:0.19.1:test
[INFO] |  |  +- io.quarkus:quarkus-jsonp-deployment:jar:0.19.1:test
[INFO] |  |  \- org.jboss:jandex:jar:2.1.1.Final:test
[INFO] |  +- org.junit.jupiter:junit-jupiter-api:jar:5.5.0:test
[INFO] |  |  +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |  |  \- org.junit.platform:junit-platform-commons:jar:1.5.0:test
[INFO] |  +- org.junit.jupiter:junit-jupiter-params:jar:5.5.0:test
[INFO] |  +- org.junit.jupiter:junit-jupiter-engine:jar:5.5.0:test
[INFO] |  |  \- org.junit.platform:junit-platform-engine:jar:1.5.0:test
[INFO] |  \- io.quarkus:quarkus-core:jar:0.19.1:compile
[INFO] |     +- javax.inject:javax.inject:jar:1:compile
[INFO] |     +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] |     +- io.smallrye:smallrye-config:jar:1.3.5:compile
[INFO] |     |  \- org.eclipse.microprofile.config:microprofile-config-api:jar:1.3:compile
[INFO] |     |     \- org.osgi:org.osgi.annotation.versioning:jar:1.0.0:compile
[INFO] |     +- org.jboss.logmanager:jboss-logmanager-embedded:jar:1.0.3:compile
[INFO] |     +- org.jboss.logging:jboss-logging-annotations:jar:2.1.0.Final:compile
[INFO] |     +- org.jboss.threads:jboss-threads:jar:3.0.0.Beta4:compile
[INFO] |     +- org.jboss.slf4j:slf4j-jboss-logging:jar:1.2.0.Final:compile
[INFO] |     +- org.graalvm.sdk:graal-sdk:jar:19.0.2:compile
[INFO] |     +- org.wildfly.common:wildfly-common:jar:1.5.0.Final-format-001:compile
[INFO] |     +- org.wildfly.security:wildfly-elytron-ssl:jar:2.0.0.Alpha4:compile
[INFO] |     |  +- org.wildfly.security:wildfly-elytron-auth-server:jar:2.0.0.Alpha4:compile
[INFO] |     |  |  \- org.wildfly.security:wildfly-elytron-permission:jar:2.0.0.Alpha4:compile
[INFO] |     |  +- org.wildfly.security:wildfly-elytron-base:jar:2.0.0.Alpha4:compile
[INFO] |     |  +- org.wildfly.security:wildfly-elytron-credential:jar:2.0.0.Alpha4:compile
[INFO] |     |  |  +- org.wildfly.security:wildfly-elytron-keystore:jar:2.0.0.Alpha4:compile
[INFO] |     |  |  \- org.wildfly.security:wildfly-elytron-provider-util:jar:2.0.0.Alpha4:compile
[INFO] |     |  +- org.wildfly.security:wildfly-elytron-auth:jar:2.0.0.Alpha4:compile
[INFO] |     |  +- org.wildfly.security:wildfly-elytron-util:jar:2.0.0.Alpha4:compile
[INFO] |     |  \- org.wildfly.security:wildfly-elytron-x500:jar:2.0.0.Alpha4:compile
[INFO] |     \- org.wildfly.security:wildfly-elytron-x500-cert:jar:2.0.0.Alpha4:compile
[INFO] |        +- org.wildfly.security:wildfly-elytron-asn1:jar:2.0.0.Alpha4:compile
[INFO] |        \- org.wildfly.security:wildfly-elytron-x500-cert-util:jar:2.0.0.Alpha4:compile
[INFO] \- io.rest-assured:rest-assured:jar:3.3.0:test
[INFO]    +- org.codehaus.groovy:groovy:jar:2.4.15:test
[INFO]    +- org.codehaus.groovy:groovy-xml:jar:2.4.15:test
[INFO]    +- org.apache.httpcomponents:httpclient:jar:4.5.9:test
[INFO]    |  +- org.apache.httpcomponents:httpcore:jar:4.4.11:test
[INFO]    |  +- commons-logging:commons-logging:jar:1.2:test
[INFO]    |  \- commons-codec:commons-codec:jar:1.11:test
[INFO]    +- org.apache.httpcomponents:httpmime:jar:4.5.3:test
[INFO]    +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO]    +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO]    +- org.ccil.cowan.tagsoup:tagsoup:jar:1.2.1:test
[INFO]    +- io.rest-assured:json-path:jar:3.3.0:test
[INFO]    |  +- org.codehaus.groovy:groovy-json:jar:2.4.15:test
[INFO]    |  \- io.rest-assured:rest-assured-common:jar:3.3.0:test
[INFO]    \- io.rest-assured:xml-path:jar:3.3.0:test
[INFO]       +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO]       \- org.apache.sling:org.apache.sling.javax.activation:jar:0.1.0:test

编辑2 :添加完整的堆栈信息

2019-08-06 14:44:07,908 INFO  [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus augmentation
2019-08-06 14:44:09,055 INFO  [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 1147ms
2019-08-06 14:44:10,208 INFO  [com.agf.orb.orm.LifecycleManager] (main) Bootstrap proxy on /127.0.0.1:8888
2019-08-06 14:44:10,346 INFO  [com.agf.orb.orm.LifecycleManager] (main) Loaded config file from D:/dev/tmp/chaos.conf
2019-08-06 14:44:10,346 INFO  [com.agf.orb.orm.LifecycleManager] (main) Chaos Proxy started. Read/Write/Delete configuration via GET|PUT|DELETE /resources/chaos/conf.
2019-08-06 14:44:10,348 INFO  [io.quarkus] (main) Quarkus 0.19.1 started in 2.657s. Listening on: http://[::]:18080
2019-08-06 14:44:10,349 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy, resteasy-jsonb]
2019-08-06 14:44:18,744 ERROR [org.lit.pro.imp.ClientToProxyConnection] (LittleProxy-0-ClientToProxyWorker-0) (AWAITING_INITIAL) [id: 0x95348e38, L:/127.0.0.1:8888 - R:/127.0.0.1:63611]: Caught an exception on ClientToProxyConnection: java.lang.NoSuchMethodError: com.google.common.net.HostAndPort.getHostText()Ljava/lang/String;
        at org.littleshoot.proxy.impl.ProxyToServerConnection.addressFor(ProxyToServerConnection.java:961)
        at org.littleshoot.proxy.impl.ProxyToServerConnection.setupConnectionParameters(ProxyToServerConnection.java:832)
        at org.littleshoot.proxy.impl.ProxyToServerConnection.<init>(ProxyToServerConnection.java:199)
        at org.littleshoot.proxy.impl.ProxyToServerConnection.create(ProxyToServerConnection.java:173)
        at org.littleshoot.proxy.impl.ClientToProxyConnection.doReadHTTPInitial(ClientToProxyConnection.java:300)
        at org.littleshoot.proxy.impl.ClientToProxyConnection.readHTTPInitial(ClientToProxyConnection.java:206)
        at org.littleshoot.proxy.impl.ClientToProxyConnection.readHTTPInitial(ClientToProxyConnection.java:80)
        at org.littleshoot.proxy.impl.ProxyConnection.readHTTP(ProxyConnection.java:135)
        at org.littleshoot.proxy.impl.ProxyConnection.read(ProxyConnection.java:120)
        at org.littleshoot.proxy.impl.ProxyConnection.channelRead0(ProxyConnection.java:587)
        at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337)
        at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337)
        at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
        at org.littleshoot.proxy.impl.ProxyConnection$RequestReadMonitor.channelRead(ProxyConnection.java:715)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:323)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:297)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337)
        at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
        at org.littleshoot.proxy.impl.ProxyConnection$BytesReadMonitor.channelRead(ProxyConnection.java:692)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:677)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:612)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:529)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:491)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905)
        at java.lang.Thread.run(Thread.java:748)

1 个答案:

答案 0 :(得分:1)

我可以通过添加以下内容来解决您描述的问题:

  <dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>20.0</version>
  </dependency>

在Maven的dependencyManagement部分(在littleproxy之后)。

请注意,由于guava是maven-embedder的临时依赖项,因此将来可能会改变,但是此依赖项的代码库已经updated删除了番石榴,因此Quarkus需要选择新的版本