springBoot启动失败This is very likely to create a memory leak. Stack trace of sun.misc.Unsafe.park

报错信息如下:

01-17 09:18:38.158 WARN  [o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compljsController': Unsatisfied dependency expressed through field 'compljsService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compljsServiceImpl': Unsatisfied dependency expressed through field 'compljsMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.ljs.modules.compljssive.mapper.CompljsMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
01-17 09:18:38.162 WARN  [o.s.beans.factory.support.DisposableBeanAdapter] - Destroy method 'close' on bean with name 'eurekaRegistration' threw an exception: org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
01-17 09:18:38.189 INFO  [org.apache.catalina.core.StandardService] - Stopping service [Tomcat]
01-17 09:18:38.264 WARN  [org.apache.catalina.loader.WebappClassLoaderBase] - 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.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 java.lang.Thread.run(Thread.java:748)
01-17 09:18:38.280 INFO  [o.s.b.a.l.ConditionEvaluationReportLoggingListener] - 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
01-17 09:18:38.633 ERROR [o.s.b.diagnostics.LoggingFailureAnalysisReporter] - 

***************************
APPLICATION FAILED TO START
***************************

Description:

Field compljsMapper in com.ljs.modules.ljssive.service.impl.CompljsServiceImpl required a bean of type 'com.ljs.modules.comljs.mapper.CompljsMapper' that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'com.ljs.modules.ljssive.mapper.CompljsMapper' in your configuration.

Disconnected from the target VM, address: '127.0.0.1:52000', transport: 'socket'

Process finished with exit code 1

原因解释:

网上也有资料说是循环调用,举个例子,A类中引入B类,B类中引入A类,被锁造成。不排除这种原因。

但是在动手排除这稍微复杂的原因之前,建议先看看启动类main方法上边的包扫描路径对不对。

如下:

@MapperScan({"com.ljs.**.mapper", "com.ljs.**.dao"})
@EnableAsync
@EnableDiscoveryClient
@EnableEurekaClient
@EnableFeignClients
@EnableTransactionManagement
@EnableScheduling
@EnableCaching
@ComponentScan(value = {"com.ljs"})
@Slf4j
@EnableHystrix
@EnableHystrixDashboard
@SpringBootApplication
public class MljsApplication {
    public static void main(String[] args) {
        SpringApplication.run(MljsApplication.class, args);
    }
}

我的项目启动报错原因在于,@MapperScan({"com.ljs.**.mapper", "com.ljs.**.dao"})这个包扫描路径问题,现在写法是正确的。

通过翻看Git历史,发现并没有修改记录。后来想到,可能是由于写代码时,误触快捷键,idea将启动类的包扫描路径做了自动修改。导致模块扫描不到类,无法启动。

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值