gpt4 book ai didi

java.lang.NoSuchMethodError : com. google.common.base.Preconditions.checkArgument

转载 作者:IT老高 更新时间:2023-10-28 20:47:40 29 4
gpt4 key购买 nike

我正在尝试运行 grpc-Java我本地的例子。对应的 proto 文件是 here .当我尝试在本地运行时,它会从 here 引发以下异常:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
at io.grpc.ServiceDescriptor.validateMethodNames(ServiceDescriptor.java:129)
at io.grpc.ServiceDescriptor.<init>(ServiceDescriptor.java:83)
at io.grpc.ServiceDescriptor.<init>(ServiceDescriptor.java:51)
at io.grpc.ServiceDescriptor$Builder.build(ServiceDescriptor.java:219)
at io.grpc.examples.helloworld.GreeterGrpc.getServiceDescriptor(GreeterGrpc.java:251)
at io.grpc.examples.helloworld.GreeterGrpc$GreeterImplBase.bindService(GreeterGrpc.java:84)
at io.grpc.internal.AbstractServerImplBuilder.addService(AbstractServerImplBuilder.java:125)
at io.grpc.internal.AbstractServerImplBuilder.addService(AbstractServerImplBuilder.java:63)
at com.cw.predictive.HelloWorldServer.start(HelloWorldServer.java:56)
at com.cw.predictive.HelloWorldServer.main(HelloWorldServer.java:92)

这是我提到的 pom.xml here :

 <dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>1.1.2</version>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.1.2</version>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.1.2</version>
</dependency>
</dependencies>

最佳答案

**Please add following dependencies in your project.**
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.6-jre</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.8</version>
</dependency>

关于java.lang.NoSuchMethodError : com. google.common.base.Preconditions.checkArgument,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42206440/

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