简体   繁体   中英

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

I am trying to run this grpc-Java example on my local. Corresponding proto file for the same is here . When i try to run in on local it throws the following exception from 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)

This is my pom.xml as mentioned 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>

I have installed Hadoop 3.2.1 and HIVE 3.1.2 in Unbuntu and facing the same error as mentioned by u. Please share the commands that u did for updating guice file. enter image description here

Regards, Swati

For anyone else getting this error on EMR. In order to use the s3a address system for S3 files I needed the S3aFileSystem Jar which didn't seem to be available on the EMR 6.7, Hadoop 3.2.1 cluster. To fix this I included --packages org.apache.hadoop:hadoop-aws:3.2.1 . Then I started getting the error noted in the OP's question. Eventually I figured out I needed to downgrade from the patched version of that particular package to --packages org.apache.hadoop:hadoop-aws:3.2.0 instead. Then the problem went away.

I had this issue while trying to read a file from an S3 bucket using apache spark (PySpark). I'm using spark 3.3.0 downloaded and installed by brew on MacOS.

I solved my problem updating some jars on my spark jars folder, like @irukeru said in the comment above.

List of jars that a have updated:

Just download and copy this new jars to your spark folder, in my case, it was /usr/local/Cellar/apache-spark/3.3.0/libexec/jars

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question Error :: java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;I)V with IE and Selenium through Java Cloud Vision API Exception in thread “main” java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument java.lang.NoSuchMethodError: 'void com.google.common.base.Preconditions.checkArgument(boolean, java.lang.String, java.lang.Object) Google Cloud KMS java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;CLjava/lang/Object;)V “main” java.lang.NoSuchMethodError: 'void com.google.common.base.Preconditions.checkArgument(boolean, java.lang.String, char, java.lang.Object)' NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;CLjava/lang/Object;)V Maven - NoSuchMethodError: void com.google.common.base.Preconditions.checkArgument(boolean, java.lang.String, java.lang.Object) NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;J)V NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM