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.的更多相关文章

  1. 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 创建 ...

  2. 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 ...

  3. SpringBoot项目启动报错:java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

    .   ____          _            __ _ _ /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \( ( )\___ | '_ | '_| | ...

  4. Springboot项目启动报错,提示Cannot determine embedded database driver class for database type NONE

    我在springboot项目里面引入了数据库的配置: <dependency> <groupId>org.mybatis.spring.boot</groupId> ...

  5. springboot项目启动报错

    启动springboot项目报错: NoSuchMethodError: org.apache.tomcat.util.scan.StandardJarScanner.setJarScanFilter ...

  6. springboot项目启动报错Communications link failure

    环境情况,MySQL版本如下: 报错情况如下(看上去是和数据库有关): com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communi ...

  7. 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 : **** ...

  8. Springboot项目启动报org.springframework.beans.factory.UnsatisfiedDependencyException

    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hom ...

  9. springboot项目启动报错 Failed to configure a DataSource: 'url' attribute is not specified and no embedde

    参考:https://blog.csdn.net/Coyotess/article/details/80637837

随机推荐

  1. JavaScript Date 日期属性和方法

    JavaScript 日期(Date) Date对象用于处理日期和时间.使用对象new Date()创建日期.实例化日期有四种方式: var d1 = new Date(); var d2 = new ...

  2. mpvue小程序开发之 实现一个弹幕评论

    先上图 就是一个简单的弹幕发送功能 弹幕区的页面: <div class="content" v-show="doommData.length"> ...

  3. 2.原生js实现图片懒加载

    网上查了很多图片懒加载的内容, 但基本上都是jQuery实现的, 没有说清楚其原理, 所以研究了一下 多的不说, 上代码, 看不明白的建议看下我的上一篇文章<1. 图解浏览器和用户设备的宽高等属 ...

  4. 浅谈cookie 和 session

    一. cookie 定义:保存在浏览器本地上的一组组键值对 特点: 由服务器让浏览器进行设置的 浏览器保存在浏览器本地 下次访问时自动携带 应用: 登录 保存浏览习惯 简单的投票 使用cookie的原 ...

  5. 用实力燃爆暑期丨i春秋渗透测试工程师线下就业班开课了!

    i春秋&赛虎暑期渗透测试工程师线下就业班开课了! 本期开班地点:北京,面授脱产:四个月. 如果这次没来得及报名的同学也可以选择9月份广州的班次,具体开班时间请咨询谢老师:18513200565 ...

  6. elasticsearch 集群、节点、索引、分片、副本概念

    原文链接: https://www.jianshu.com/p/297e13045605 集群(cluster): 由一个或多个节点组成, 并通过集群名称与其他集群进行区分 节点(node): 单个 ...

  7. 使用rider做为unity的代码编辑器

    使用Rider做的编写Unity代码的IDE,记录一些与VS不相同的笔记 安装和设置方法: 我使用Rider 2019.1 + Unity3D 2018.3.4,在安装完Rider之后,在Unity中 ...

  8. OpenGL入门(一):使用GLFW创建简单的窗口

    如果使用QT,那么创建一个OpenGL渲染窗口其实很容易,不过出于初学的角度,使用GLFW库来创建新窗口. 1. 下载并配置GLFW GLFW是一个专门针对OpenGL的C语言库,它提供了一些渲染物体 ...

  9. 201871010108-高文利《面向对象程序设计(java)》第十一周学习总结

    项目 内容 这个作业属于哪个课程 <任课教师博客主页链接> https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 <作业链接地址> ht ...

  10. 201871010134-周英杰《面向对象程序设计(java)》第十三周学习总结

    201871010134-周英杰<面向对象程序设计(java)>第十三周学习总结 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ ...