java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument
我正在尝试在我的本地运行这个grpc-Java示例。相同的相应原型文件在这里。当我尝试在本地运行时,它会从这里引发以下异常:
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,如这里所提到的:
<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>