当我们在使用Sentinel集成到项目里面的时候报错:java.lang.NoClassDefFoundError: com/alibaba/csp/sentinel/spi/SpiLoaderat

当我们在使用Sentinel集成到项目里面的时候(Jar包集成)

根据本质找原因说的就是他的这个:java.lang.NoClassDefFoundError: com/alibaba/csp/sentinel/spi/SpiLoader

报错了:

INFO: Sentinel log output type is: file

INFO: Sentinel log charset is: utf-8

INFO: Sentinel log base directory is: C:\Users\Administrator\logs\csp

INFO: Sentinel log name use pid is: false

java.lang.NoClassDefFoundError: com/alibaba/csp/sentinel/spi/SpiLoader

at com.alibaba.csp.sentinel.cluster.server.processor.RequestProcessorProvider.loadAndInit(RequestProcessorProvider.java:39)

at com.alibaba.csp.sentinel.cluster.server.processor.RequestProcessorProvider.(RequestProcessorProvider.java:35)

at com.alibaba.csp.sentinel.cluster.server.init.DefaultClusterServerInitFunc.initDefaultProcessors(DefaultClusterServerInitFunc.java:64)

at com.alibaba.csp.sentinel.cluster.server.init.DefaultClusterServerInitFunc.init(DefaultClusterServerInitFunc.java:42)

at com.alibaba.csp.sentinel.init.InitExecutor.doInit(InitExecutor.java:53)

at com.alibaba.csp.sentinel.Env.(Env.java:36)

at com.alibaba.csp.sentinel.SphU.entry(SphU.java:294)

at com.alibaba.csp.sentinel.adapter.spring.webmvc.AbstractSentinelInterceptor.preHandle(AbstractSentinelInterceptor.java:105)

at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:529)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)

at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)

at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481)

at org.apache.catalina.core.StandardHostValve.$sw$original$invoke$s4bue91(StandardHostValve.java:130)

at org.apache.catalina.core.StandardHostValve.$sw$original$invoke$s4bue91$accessor$$sw$p8ebm33(StandardHostValve.java)

at org.apache.catalina.core.StandardHostValve$$sw$auxiliary$48kjgq1.call(Unknown Source)

at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:390)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1790)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.base/java.lang.Thread.run(Thread.java:842)

Caused by: java.lang.ClassNotFoundException: com.alibaba.csp.sentinel.spi.SpiLoader

at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)

at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)

... 53 more

这个时候我查了很多资料了解了很多都没有搞出来,最后等我都快休息的时候然后突然我的脑子冒出来一个想法” 是不是我的这个版本的问题 “ 然后我就检查了我的Maven里面Sentinel的版本。

进入Maven生命周期然后查看里面的依赖结构

我们得把他们的依赖版本都统一

改完是这样的

他们这个依赖统一了一致了这个报错就解了

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值