问题描述:文章来源:https://www.toymoban.com/news/detail-539840.html
- 引入sentinel的相关依赖之后,启动项目服务,发现如下错误
Error: failed to initialize Sentinel CommandCenterLog
java.lang.NoClassDefFoundError: com/alibaba/csp/sentinel/log/LoggerSpiProvider
at com.alibaba.csp.sentinel.transport.log.CommandCenterLog.<clinit>(CommandCenterLog.java:36)
at com.alibaba.csp.sentinel.transport.command.SimpleHttpCommandCenter$2.run(SimpleHttpCommandCenter.java:104)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.alibaba.csp.sentinel.log.LoggerSpiProvider
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
Exception in thread "Thread-73" java.lang.NoClassDefFoundError: com/alibaba/csp/sentinel/log/Logger
at com.alibaba.csp.sentinel.transport.log.CommandCenterLog.info(CommandCenterLog.java:48)
at com.alibaba.csp.sentinel.transport.command.SimpleHttpCommandCenter$2.run(SimpleHttpCommandCenter.java:104)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.alibaba.csp.sentinel.log.Logger
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
问题解决:文章来源地址https://www.toymoban.com/news/detail-539840.html
- 在引入sentinel依赖的地方引入下面的依赖
spring-boot-starter-ahas-sentinel-client
即可成功解决!
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>spring-boot-starter-ahas-sentinel-client</artifactId>
<version>1.4.0</version>
</dependency>
到了这里,关于【Java遇错】Error: failed to initialize Sentinel CommandCenterLog的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!