【排错】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
随机推荐
- Ajax异步后台加载Html绑定不上事件
因项目需要,需要实时从后台动态加载html,开发过程中,遇到事件绑定不上,后来百度一番,大概意思:ajax是异步加载的,页面一开始绑定事件的时候,后台数据还没有传过来,就绑定事件,这个时候找不到这个d ...
- 前端开发CSS3——使用方式和选择器
CSS是Cascading Style Sheets(层叠样式表)的简写,用于修饰文档的语言,可以修饰HTML.XML.SVN.每个语言都有每个语法的规则:CSS声明.CSS声明块.CSS选择器.CS ...
- 7 CentOS 7网卡配置
首先重中之重:修改前一定要进行系统备份,如果是虚拟机进行快照 查看虚拟机的网卡配置 注意桥接模式和NAT模式 桥接模式:网络层面,虚拟机和PC处于同级地位,虚拟机直接和路由器相连 NA ...
- Google Analytics 学习笔记一 —— GA简介
GA的原理 网页页面添加GA跟踪代码,以"一像素"传递信息给服务器 hit(交互) --> sessions(会话) --> user(用户) 竞品对比 Firebas ...
- element-ui的tag组件关闭事件失效的原因
问题如上,原因是忘了加上一个函数 @close="handleClose(tag)" <el-tag :key="tag" v-for="tag ...
- MS17-010漏洞利用复现
MS17-010漏洞利用复现 准备环境: win7靶机 IP地址:172.16.15.118 Kali攻击机 IP地址:172.16.15.50 首先我们需要查看一下靶机是否开启445端口 打开kal ...
- XGBoost和LightGBM的参数以及调参
一.XGBoost参数解释 XGBoost的参数一共分为三类: 通用参数:宏观函数控制. Booster参数:控制每一步的booster(tree/regression).booster参数一般可以调 ...
- 2.1 Scala语言概述
一.编程范式 命令式编程没有办法充分利用多核CPU: 函数式编程很多变量是不可修改的. 二.Scala简介 特点 scala运行在JVM上,兼容现有的Java程序: 面向对象的编程语言: 一门函数式语 ...
- 阿里云Web应用防火墙采用规则引擎、语义分析和深度学习引擎相结合的方式防护Web攻击
深度学习引擎最佳实践 {#concept_1113021 .concept} 阿里云Web应用防火墙采用多种Web攻击检测引擎组合的方式为您的网站提供全面防护.Web应用防火墙采用规则引擎.语义分析和 ...
- cisco
配置ntp conf t ntp server 172.28.10.10 clock timezone Beijing 8 show clock 配置端口组 interface Port-channe ...