【排错】springboot项目,启动报An attempt was made to call the method com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; but it does not exist.
pom文件新引入:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3</version>
</dependency> 但启动后报错:
An attempt was made to call the method com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; but it does not exist. Its class, com.google.gson.GsonBuilder, is available from the following locations:
jar:file:/home/haoyun/apache-tomcat-8.5.40/webapps/admin/WEB-INF/lib/gson-2.3.1.jar!/com/google/gson/GsonBuilder.class
It was loaded from the following location:
file:/home/haoyun/apache-tomcat-8.5.40/webapps/admin/WEB-INF/lib/gson-2.3.1.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.google.gson.GsonBuilder
14-Oct-2019 17:27:33.004 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/admin]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:980)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1851)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
当前引入的gson版本是2.3的,在Maven dependience中查看有2.8.5的版本依赖,可是我全文搜索都不知道项目原来在哪里引入过gson的依赖。
原来父pom中有spring-boot-starter-parent
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
</parent> 点击上面的spring-boot-starter-parent,查看其源码,发现它又继承了spring-boot-dependencies:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath>../../spring-boot-dependencies</relativePath>
</parent> 点击上面的spring-boot-dependencies,查看其源码,搜索gson,发现这里确实已经引入了gson的依赖:2.8.5 解决办法:pom.xml 里引入依赖时,删掉 <version>2.3</version>这一行,Spring Boot 会自动查找匹配最合适的版本。
【排错】springboot项目,启动报An attempt was made to call the method com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; but it does not exist.的更多相关文章
- springboot项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde
springboot项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde 创建 ...
- An attempt was made to call the method com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; but it does not exist. Its class, com.google.gson.GsonBuilder, is available from the foll
SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/G:/sharp/repo ...
- SpringBoot项目启动报错:java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \( ( )\___ | '_ | '_| | ...
- Springboot项目启动报错,提示Cannot determine embedded database driver class for database type NONE
我在springboot项目里面引入了数据库的配置: <dependency> <groupId>org.mybatis.spring.boot</groupId> ...
- springboot项目启动报错
启动springboot项目报错: NoSuchMethodError: org.apache.tomcat.util.scan.StandardJarScanner.setJarScanFilter ...
- springboot项目启动报错Communications link failure
环境情况,MySQL版本如下: 报错情况如下(看上去是和数据库有关): com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communi ...
- springboot项目启动报错 url' attribute is not specified and no embedded datasource could be configured
报错相关信息: 2019-07-22 17:12:48.971 ERROR 8312 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : **** ...
- Springboot项目启动报org.springframework.beans.factory.UnsatisfiedDependencyException
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hom ...
- springboot项目启动报错 Failed to configure a DataSource: 'url' attribute is not specified and no embedde
参考:https://blog.csdn.net/Coyotess/article/details/80637837
随机推荐
- 二十三:原型模式详解(clone复制方法源码)
定义:用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象. 定义比较简单,总结一下是通过实例指定种类,通过拷贝创建对象. 在JAVA语言中使用原型模式是非常 ...
- 腾讯WeTest携手拉夏贝尔共筑电商小程序安全壁垒
上海拉夏贝尔服饰股份有限公司成立于1998年,是中国快速发展的多品牌时尚运营企业.La Chapelle品牌创立初衷正是希望通过精美别致的时装设计,将法式优雅精致的风情元素和对生活的认知感悟传递给都市 ...
- https申请证书并部署到网站流程,浏览器验证证书流程
https申请证书并部署到网站流程: 1.生成一对秘钥,设公钥为pubk1,私钥为prik12.假设发布的网站地址为https://www.example.com3.生成一个CSR文件(Cerific ...
- php 除10取整,取十位数前面一个数字,百位前两个数字
需求:php 除10取整,取十位数前面一个数字,百位前两个数字,并把大于2的加红显示 例:0-9,10-19,20-29,30-39,110-119对应为:0 1 2 3 11 实现主要方法:$num ...
- wc项目(node.js实现)
一.github地址:https://github.com/Jasminejiamei/homework-wc 二.PSP PSP Personal Software Process Stages 预 ...
- [PHP] 广度优先搜索匹配网站所有链接
<?php define('PRE_DOMAIN','www'); define('DOMAIN','sina.com.cn'); define('PROTOCOL','https'); def ...
- Python元组与字符串操作(8)——三数排序多种实现
练习 依次接收用户输入的3个数,排序后打印 1.转换int后,判断大小排序,使用分支结构完成 num1 = [] for i in range(3): num1.append(int(input('& ...
- 17、DNS服务器
DNS domain name system 域名系统 [root@li ~]# vim /etc/nsswitch.conf hosts: files dns --涉及到 ...
- linux (04) linux安装mysql
https://www.cnblogs.com/pyyu/p/9467289.html mysql博客 一.mysql (分支 mariadb) 1.安装mariadb -yum -源码编译安 ...
- pdfium:创建CreateNewDoc
CreateNewDoc //创建文档 https://github.com/PureFusionOS/android_external_pdfium/blob/040b899a933cdb37 ...