***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
io.grpc.Metadata$Key.validateName(Metadata.java:754)
The following method did not exist:
com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;CLjava/lang/Object;)V
The calling method's class, io.grpc.Metadata$Key, was loaded from the following location:
jar:file:/home/mi/.m2/repository/io/grpc/grpc-api/1.64.0/grpc-api-1.64.0.jar!/io/grpc/Metadata$Key.class
The called method's class, com.google.common.base.Preconditions, is available from the following locations:
jar:file:/home/mi/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar!/com/google/common/base/Preconditions.class
The called method's class hierarchy was loaded from the following locations:
com.google.common.base.Preconditions: file:/home/mi/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes io.grpc.Metadata$Key and com.google.common.base.Preconditions
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;CLjava/lang/Object;)V
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:160)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440)
解决方法:
原因是,grpc和thirft都有相同的依赖,只不过版本不一样
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.64.0</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.facebook.swift</groupId>
<artifactId>swift-service</artifactId>
<version>0.15.0-mdf1.1.4</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.bval</groupId>
<artifactId>bval-jsr303</artifactId>
</exclusion>
</exclusions>
</dependency>