maven jar包版本冲突
<h1>问题</h1>
<hr />
<p>Description:</p>
<p>An attempt was made to call a method that does not exist. The attempt was made from the following location:</p>
<pre><code>io.grpc.Metadata$Key.validateName(Metadata.java:629)</code></pre>
<p>The following method did not exist:</p>
<pre><code>com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;CLjava/lang/Object;)V</code></pre>
<p>The method's class, com.google.common.base.Preconditions, is available from the following locations:</p>
<pre><code>jar:file:/opt/deploy/mdfs-tile/v1.1/14/mdfs-tile-1.1.14.jar!/BOOT-INF/lib/guava-19.0.jar!/com/google/common/base/Preconditions.class</code></pre>
<p>It was loaded from the following location:</p>
<pre><code>jar:file:/opt/deploy/mdfs-tile/v1.1/14/mdfs-tile-1.1.14.jar!/BOOT-INF/lib/guava-19.0.jar!/</code></pre>
<p>Action:</p>
<p>Correct the classpath of your application so that it contains a single, compatible version of com.google.common.base.Precondi</p>
<h1>排查</h1>
<p><a href="https://stackoverflow.com/questions/45247193/nosuchmethoderror-com-google-common-base-preconditions-checkargumentzljava-lan">https://stackoverflow.com/questions/45247193/nosuchmethoderror-com-google-common-base-preconditions-checkargumentzljava-lan</a>
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/08177294a9df6f44b8c17ed1f92911ad?showdoc=.jpg" alt="" /></p>
<pre><code class="language-shell">>mvn dependency:tree|grep guava -C 5
[INFO] | | \- org.mozilla:rhino:jar:1.7R5:compile
[INFO] | \- org.rosuda:JRI:jar:1.0:compile
[INFO] +- com.hyt:mdfs:jar:1.0:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.28:compile
[INFO] | \- com.datastax.cassandra:cassandra-driver-core:jar:3.6.0:compile
[INFO] | +- com.google.guava:guava:jar:19.0:compile
[INFO] | +- io.dropwizard.metrics:metrics-core:jar:4.0.6:compile
[INFO] | +- com.github.jnr:jnr-ffi:jar:2.1.7:compile
[INFO] | | +- com.github.jnr:jffi:jar:1.2.16:compile
[INFO] | | +- com.github.jnr:jffi:jar:native:1.2.16:runtime
[INFO] | | +- org.ow2.asm:asm:jar:5.0.3:compile</code></pre>
<h1>解决</h1>
<p>在pom.xml中dependencies部分最前面添加guava的最新版本依赖</p>
<pre><code class="language-xml"><!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
</dependency></code></pre>