最近做springboot +springcloud项目时候遇见了好几次这个错误,百度的方法都不管用,最后检查发现了原因,供大家参考
The web application [ROOT] appears to have started a thread named [RxIoScheduler-1 (Evictor)] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
错误如下:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fhxInternalClaimService’ defined in file [D:\reins-internal-excess-backend\target\classes\com\pdfc\platform\application\service\fhxinternal\FhxInternalClaimService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fhxInternalClaimDomainService’ defined in file [D:\reins-internal-excess-backend\target\classes\com\pdfc\platform\domain\fhxinternalclaim\service\FhxInternalClaimDomainService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fhxInternalClaimDao’ defined in file [D:\reins-internal-excess-backend\target\classes\com\pdfc\platform\domain\fhxinternalclaim\repository\facade\FhxInternalClaimDao.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘sqlSessionFactory’ threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [D:\reins-internal-excess-backend\target\classes\mapper\custom\fhxinternaltreaty\FhxInternalTreatyDao.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘file [D:\reins-internal-excess-backend\target\classes\mapper\custom\fhxinternaltreaty\FhxInternalTreatyDao.xml]’. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for com.pdfc.platform.domain.fhxinternaltreaty.repository.facade.FhxInternalTreatyDao.selectTreatyInfoAndFzacc. please check file [D:\reins-internal-excess-backend\target\classes\mapper\custom\fhxinternaltreaty\FhxInternalTreatyDao.xml] and file [D:\reins-internal-excess-backend\target\classes\mapper\custom\fhxinternaltreaty\FhxInternalTreatyDao.xml]
The web application [ROOT] appears to have started a thread named [RxIoScheduler-1 (Evictor)] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
java.util.concurrent.locks.AbstractQueuedSynchronizerDelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
java.util.concurrent.ScheduledThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:744)
百度得到的问题和解决方案如下几种:
-
注解用错
检查类的注解是不是用错了,或者拼错了 -
配置文件错误
xml中应该配置的引用包,相应的配置没有配置 -
jar包问题
引用的jar包冲突,或者没有引用相关的jar包
我的原因有好几种,
第一种:启功配置没有配置参数
如下图的Vm options
第二种:
Mybatis的Mapper里面sql语法有错误,id标志不唯一
我的原因就是写了两个id相同的sql
第三种:
项目打包成功后,没有重启consul
本菜鸟自己创建的交流群,欢迎大佬和java学习者加入扣扣群:344635699