gpt4 book ai didi

guava - NoSuchMethodError : com. google.common.base.Preconditions.checkArgument 错误

转载 作者:行者123 更新时间:2023-12-05 03:06:34 29 4
gpt4 key购买 nike

我一直收到这个错误:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;I)V
at com.google.cloud.pubsub.v1.Subscriber.<init>(Subscriber.java:138)
at com.google.cloud.pubsub.v1.Subscriber.<init>(Subscriber.java:93)
at com.google.cloud.pubsub.v1.Subscriber$Builder.build(Subscriber.java:623)
at com.vanitysoft.payit.domain.dao.SubApp.main(SubApp.java:31)

我的 pom.xml 里有这个

    <dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-pubsub</artifactId>
<version>0.32.0-beta</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.5-jre</version>
</dependency>

有人可以分享 google pub/sub 的 pom 设置吗?我使用的是独立应用。

最佳答案

com.google.cloud:google-cloud-pubsub:0.32.0-beta 传递需要 com.google.guava:guava:jar:20.0 但你有用更新的版本覆盖 Guava。您可以通过运行 mvn dependency:tree 来查看它:

\- com.google.cloud:google-cloud-pubsub:jar:0.32.0-beta:compile
+- io.netty:netty-tcnative-boringssl-static:jar:2.0.6.Final:compile
+- com.google.cloud:google-cloud-core:jar:1.14.0:compile
| +- com.google.guava:guava:jar:20.0:compile
| +- joda-time:joda-time:jar:2.9.2:compile
| +- org.json:json:jar:20160810:compile
| +- com.google.http-client:google-http-client:jar:1.23.0:compile
| | \- org.apache.httpcomponents:httpclient:jar:4.0.1:compile
| | +- org.apache.httpcomponents:httpcore:jar:4.0.1:compile
| | +- commons-logging:commons-logging:jar:1.1.1:compile
| | \- commons-codec:commons-codec:jar:1.3:compile
| +- com.google.code.findbugs:jsr305:jar:3.0.0:compile
| +- com.google.api:api-common:jar:1.2.0:compile
| +- com.google.api:gax:jar:1.15.0:compile
| | +- com.google.auto.value:auto-value:jar:1.2:compile
| | +- org.threeten:threetenbp:jar:1.3.3:compile
| | \- com.google.auth:google-auth-library-oauth2-http:jar:0.9.0:compile
| | \- com.google.http-client:google-http-client-jackson2:jar:1.19.0:compile
| | \- com.fasterxml.jackson.core:jackson-core:jar:2.1.3:compile
| +- com.google.protobuf:protobuf-java-util:jar:3.4.0:compile
| | \- com.google.code.gson:gson:jar:2.7:compile
| +- com.google.api.grpc:proto-google-common-protos:jar:1.0.2:compile
| \- com.google.api.grpc:proto-google-iam-v1:jar:0.1.26:compile
+- com.google.cloud:google-cloud-core-grpc:jar:1.14.0:compile
| +- com.google.auth:google-auth-library-credentials:jar:0.9.0:compile
| +- com.google.protobuf:protobuf-java:jar:3.4.0:compile
| +- io.grpc:grpc-protobuf:jar:1.7.0:compile
| | \- io.grpc:grpc-protobuf-lite:jar:1.7.0:compile
| +- io.grpc:grpc-context:jar:1.7.0:compile
| \- com.google.api:gax-grpc:jar:1.15.0:compile
+- com.google.api.grpc:proto-google-cloud-pubsub-v1:jar:0.1.26:compile
+- com.google.api.grpc:grpc-google-cloud-pubsub-v1:jar:0.1.26:compile
+- io.grpc:grpc-netty:jar:1.7.0:compile
| +- io.grpc:grpc-core:jar:1.7.0:compile (version selected from constraint [1.7.0,1.7.0])
| | +- com.google.errorprone:error_prone_annotations:jar:2.0.19:compile
| | +- com.google.instrumentation:instrumentation-api:jar:0.4.3:compile
| | \- io.opencensus:opencensus-api:jar:0.6.0:compile
| +- io.netty:netty-codec-http2:jar:4.1.16.Final:compile (version selected from constraint [4.1.16.Final,4.1.16.Final])
| | +- io.netty:netty-codec-http:jar:4.1.16.Final:compile
| | | \- io.netty:netty-codec:jar:4.1.16.Final:compile
| | \- io.netty:netty-handler:jar:4.1.16.Final:compile
| | \- io.netty:netty-buffer:jar:4.1.16.Final:compile
| | \- io.netty:netty-common:jar:4.1.16.Final:compile
| \- io.netty:netty-handler-proxy:jar:4.1.16.Final:compile
| +- io.netty:netty-transport:jar:4.1.16.Final:compile
| | \- io.netty:netty-resolver:jar:4.1.16.Final:compile
| \- io.netty:netty-codec-socks:jar:4.1.16.Final:compile
+- io.grpc:grpc-stub:jar:1.7.0:compile
\- io.grpc:grpc-auth:jar:1.7.0:compile

根据您的 pom.xml 片段,您应该删除您的 Guava 版本,除非您项目中的其他一些库需要这个更新的版本。

关于guava - NoSuchMethodError : com. google.common.base.Preconditions.checkArgument 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49060034/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com