SpringCloud中使用Hystrix时报错java.lang.ClassNotFoundException: org.HdrHistogram.Histogram

在SpringCloud项目中使用Hystrix时遇到`java.lang.ClassNotFoundException: org.HdrHistogram.Histogram`错误。问题出在spring-cloud-starter-netflix-hystrix依赖的HdrHistogram版本过低,需升级至2.1.10或以上。解决方案包括在父工程中管理HdrHistogram的高版本,或者直接更新Hystrix依赖确保加载正确版本。
摘要由CSDN通过智能技术生成

使用 SpringCloud 的 Hystrix 熔断器时报出如下错误:

Servlet.service() for servlet [dispatcherServlet] in context with path [/showConsumer] threw exception [Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/HdrHistogram/Histogram] with root cause
java.lang.ClassNotFoundException: org.HdrHistogram.Histogram
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at com.netflix.hystrix.metric.CachedValuesHistogram.getNewHistogram(CachedValuesHistogram.java:148)
	at com.netflix.hystrix.metric.consumer.RollingDistributionStream.<init>(RollingDistributionStream.java:49)
	at com.netflix.hystrix.metric.consumer.RollingCommandLatencyDistributionStream.<init>(RollingCommandLatencyDistributionStream.java:93)
	at com.netflix.hystrix.metric.consumer.RollingCommandLatencyDistributionStream.getInstance(RollingCommandLatencyDistributionStream.java:78)
	at com.netflix.hystrix.metric.consumer.RollingCommandLatencyDistributionStream.getInstance(RollingCommandLatencyDistributionStream.java:67)
	at com.netflix.hystrix.HystrixCommandMetrics.<init>(HystrixCommandMetrics.java:196)
	at com.netflix.hystrix.HystrixCommandMetrics.getInstance(HystrixCommandMetrics.java:134)
	at com.netflix.hystrix.AbstractCommand.initMetrics(AbstractCommand.java:240)
	at com.netflix.hystrix.AbstractCommand.<init>(AbstractCommand.java:166)
	at com.netflix.hystrix.HystrixCommand.<init>(HystrixCommand.java:148)
	at com.netflix.hystrix.HystrixCommand.<init>(HystrixCommand.java:134)
	at com.netflix.hystrix.contrib.javanica.command.AbstractHystrixCommand.<init>(AbstractHystrixCommand.java:51)
	at com.netflix.hystrix.contrib.javanica.command.GenericCommand.<init>(GenericCommand.java:36)
	at com.netflix.hystrix.contrib.javanica.command.HystrixCommandFactory.create(HystrixCommandFactory.java:43)
	at com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect.methodsAnnotatedWithHystrixCommand(HystrixCommandAspect.java:94)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorIm
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值