概述
springboot引用gson包后启动时出现下面错误信息
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
java.lang.invoke.MethodHandleNatives.resolve(Native Method)
The following method did not exist:
com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder;
The method's class, com.google.gson.GsonBuilder, is available from the following locations:
jar:file:/Users/xu/.m2/repository/com/google/code/gson/gson/2.2.2/gson-2.2.2.jar!/com/google/gson/GsonBuilder.class
jar:file:/Users/xu/work/wrapper/libs/gson-2.2.2.jar!/com/google/gson/GsonBuilder.class
It was loaded from the following location:
file:/Users/xu/.m2/repository/com/google/code/gson/gson/2.2.2/gson-2.2.2.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.google.gson.GsonBuilder
Process finished with exit code 1
解决办法:
将pom中gson版本改完2.6解决。
<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.6</version> </dependency>
最后
以上就是飘逸西装为你收集整理的springboot引用gson包出现的问题的全部内容,希望文章能够帮你解决springboot引用gson包出现的问题所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复