昨天再引入包的时候,Run了下main直接报错,就知道是包版本冲突了,然后添加的包排除,启动是正常了,但是项目一跑方法直接抛出来,gson转换异常,所以又得放开,于是尝试下引入Gson包试试
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
添加上来之后问题解决,版本冲突也没有了,运行是出现的问题也没有了,顺利解决,心情好多了
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-04-21 10:54:02.793 ERROR 38720 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
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:/D:/m2/repository/com/google/code/gson/gson/2.1/gson-2.1.jar!/com/google/gson/GsonBuilder.class
It was loaded from the following location:
file:/D:/m2/repository/com/google/code/gson/gson/2.1/gson-2.1.jar
启动
Spring
项目失败,日志提示Error creating bean with name ‘
gson
Builder’ defined in class path resource
这里是在提醒创建在类路径资源中定义了名为“
gson
Builder”的bean时出错,通常是
gson
Builder这个依赖
包
有
冲突
,比如你pom导入的依赖
包
下,有子依赖
包
与
Spring
的子依赖
包
重复时,就会抛出这个错误,根据类路径资源导入bean时抛出了这个错误。
笔者完整抛错如下:
2021-04-14 23:33:38..
在使用
Spring
的时候,经常会使用到第三方库,一般大家都是根据经验挑选一个版本号或挑选最新的,随意性较大,其实这是有问题的,除非做过完整的测试,保证
集成
该版本的依赖不会出现问题,且后续
集成
其它第三方库的时候也不会出现问题,否则风险较大,且后续扩展会越来越困难,因为随着业务复杂度的增加,
集成
的第三方组件会越来会多,依赖之间的关联也会也来越复杂。
好消息是,
Spring
IO P...
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.resol...
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.
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
java.lang.invoke.MethodHandleNati...
2018-10-12 11:06:23.345 ERROR 9947 --- [ main] o.s.boot.
Spring
Application : Application run failed
org.
spring
framework.beans.factory.BeanCreationException: Error creating bea...
后端报错如下:
WARN [] o.s.b.t.j.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer.logDuplicateJsonObjectsWarning -
Found multiple occurrences of org.json.JSONObject on the class path:
jar:file:/D:/java_code/maven/repository/or
曾经,我遇到一个bug,同样的请求方法,定义在自定义控件TitleBar里面,在未打
包
的时候能拿到数据,但是,打
包
之后,怎么都看不到数据,各种方式,各种测试,最终发现,还是不行,拿不到数据,Today,我一步一步的检测到
Gson
解析的时候,我发现打
包
之后的数据,经过
Gson
解析后,就没有了。所有请求方法都没有问题,就单单这个不行,可纠结了。最终我发现:
原因是:因为客户端代码中的Java
(1)查看某一个方法是引用的那个
包
,可以在debug的时候通过反射中的这个方法看一下
例如查看CollectionUtils这个类的jar
包
的信息,可以这样:
CollectionUtils.class.getProtectionDomain().getCo...
一般jar
包
冲突
了都会得到类似的异常java.lang.NoSuchMethodError: com.google.common.collect.Sets.newConcurrentHashSet()
总结了几种方式
一、 mvn dependency:tree
maven项目可以通过打印依赖树,定位具体的jar
包
二、 maven helper 插件
intellij idea可以安装maven helper来查找本地工程的
冲突
三、通过this.getClass().getResource("/com/
报错BUG
2020-03-27 15:50:07.084 [main] DEBUG o.s.b.d.LoggingFailureAnalysisReporter - Application failed to start due to an exception
20/01/30 01:40:14 ERROR [localhost].[/]: Failed to destroy the filter named [Tomcat WebSocket (JSR356) Filter] of type [org.apache.tomcat.websocket.server.WsFilter]
java.lang.AbstractM...