大目老师好,我在整合ahas的时候遇到了问题,引入了ahas依赖后项目启动报错。
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
<exclusions>
<exclusion>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-transport-simple-http</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>spring-boot-starter-ahas-sentinel-client</artifactId>
<version>1.10.1</version>
</dependency>
报错日志如下:
2021-12-06 15:40:48.203 INFO 12216 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-12-06 15:40:48.206 WARN 12216 — [ main] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [logback-1] 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.AbstractQueuedSynchronizerConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)java.util.concurrent.ScheduledThreadPoolExecutorConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
java.util.concurrent.ScheduledThreadPoolExecutorConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)java.util.concurrent.ScheduledThreadPoolExecutorDelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
java.util.concurrent.ScheduledThreadPoolExecutorDelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)java.util.concurrent.ThreadPoolExecutorDelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
java.util.concurrent.ThreadPoolExecutorDelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
2021-12-06 15:40:48.206 WARN 12216 — [ main] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.util.TimerThread.mainLoop(Timer.java:552)
java.util.TimerThread.run(Timer.java:505)
2021-12-06 15:40:48.206 WARN 12216 — [ main] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [com.alibaba.nacos.naming.client.listener] 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.AbstractQueuedSynchronizerConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)com.alibaba.nacos.client.naming.core.EventDispatcherConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)
com.alibaba.nacos.client.naming.core.EventDispatcherConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)com.alibaba.nacos.client.naming.core.EventDispatcherNotifier.run(EventDispatcher.java:114)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624)java.lang.Thread.run(Thread.java:748)2021−12−0615:40:48.207WARN12216−−−[main]o.a.c.loader.WebappClassLoaderBase:Thewebapplication[ROOT]appearstohavestartedathreadnamed[com.alibaba.nacos.naming.beat.sender]buthasfailedtostopit.Thisisverylikelytocreateamemoryleak.Stacktraceofthread:sun.misc.Unsafe.park(NativeMethod)java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)java.util.concurrent.locks.AbstractQueuedSynchronizerWorker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
2021-12-06 15:40:48.207 WARN 12216 --- [ main] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [com.alibaba.nacos.naming.beat.sender] 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.AbstractQueuedSynchronizerWorker.run(ThreadPoolExecutor.java:624)java.lang.Thread.run(Thread.java:748)2021−12−0615:40:48.207WARN12216−−−[main]o.a.c.loader.WebappClassLoaderBase:Thewebapplication[ROOT]appearstohavestartedathreadnamed[com.alibaba.nacos.naming.beat.sender]buthasfailedtostopit.Thisisverylikelytocreateamemoryleak.Stacktraceofthread:sun.misc.Unsafe.park(NativeMethod)java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)java.util.concurrent.locks.AbstractQueuedSynchronizerConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
java.util.concurrent.ScheduledThreadPoolExecutorDelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)java.util.concurrent.ScheduledThreadPoolExecutorDelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
java.util.concurrent.ScheduledThreadPoolExecutorDelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)java.util.concurrent.ScheduledThreadPoolExecutorDelayedWorkQueue.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)
2021-12-06 15:40:48.207 WARN 12216 — [ main] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [com.alibaba.nacos.naming.beat.sender] 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.park(LockSupport.java:175)
2021-12-06 15:40:48.207 WARN 12216 — [ main] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [com.alibaba.nacos.naming.failover] 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)
2021-12-06 15:40:48.208 WARN 12216 — [ main] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [com.alibaba.nacos.naming.push.receiver] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
2021-12-06 15:40:48.219 INFO 12216 — [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2021-12-06 15:40:48.224 ERROR 12216 — [ 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:
com.alibaba.csp.ahas.sentinel.SentinelAnnotationAutoConfiguration.sentinelResourceAspect(SentinelAnnotationAutoConfiguration.java:44)
The following method did not exist:
com.alibaba.csp.sentinel.annotation.aspectj.SentinelResourceAspect.<init>(Lcom/alibaba/csp/sentinel/annotation/aspectj/SentinelAnnotationGlobalFallback;)V
The method’s class, com.alibaba.csp.sentinel.annotation.aspectj.SentinelResourceAspect, is available from the following locations:
jar:file:/G:/gradle-repository/com/alibaba/csp/sentinel-annotation-aspectj/1.5.2/sentinel-annotation-aspectj-1.5.2.jar!/com/alibaba/csp/sentinel/annotation/aspectj/SentinelResourceAspect.class
jar:file:/G:/gradle-repository/com/alibaba/csp/ahas-sentinel-client/1.10.1/ahas-sentinel-client-1.10.1.jar!/com/alibaba/csp/sentinel/annotation/aspectj/SentinelResourceAspect.class
It was loaded from the following location:
file:/G:/gradle-repository/com/alibaba/csp/sentinel-annotation-aspectj/1.5.2/sentinel-annotation-aspectj-1.5.2.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.alibaba.csp.sentinel.annotation.aspectj.SentinelResourceAspect
面向未来微服务:熟练掌握Spring Cloud Alibaba
了解课程