hystrix java.lang.NoSuchMethodError: rx.subjects.BehaviorSubject.hasValue()Z

Posted

技术标签:

【中文标题】hystrix java.lang.NoSuchMethodError: rx.subjects.BehaviorSubject.hasValue()Z【英文标题】: 【发布时间】:2018-07-29 15:59:17 【问题描述】:

我有一个网络应用程序。该应用程序基于 JSF。我的应用程序不是基于 maven。它使用 ant 进行构建。最近我在我的应用程序中实现了 Hystrix 断路器。它工作正常。我收到“java.lang.NoSuchMethodError:rx.subjects.BehaviorSubject.hasValue()Z”。 相同的配置正在开发中。 Hystrix的详细信息如下。

我使用的库是

archaius-core-0.4.1.jar
HdrHistogram-2.1.9.jar
hystrix-core-1.5.6.jar
newrelic-api-2.21.4.jar
rxjava-1.2.0.jar
rxjava-core-0.20.3.jar

############################################################################################################
# Hystrix Configuration
############################################################################################################

# Global Defaults
hystrix.command.default.execution.timeout.enabled=true
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=30000
hystrix.command.default.fallback.enabled=false
hystrix.command.default.circuitBreaker.errorThresholdPercentage=80

# Command/Group specific overrides
hystrix.command.lookup.execution.isolation.thread.timeoutInMilliseconds=30000



# Hystrix configuration ends
############################################################################################################
Caused by: java.lang.NoSuchMethodError: rx.subjects.BehaviorSubject.hasValue()Z
        at com.netflix.hystrix.metric.consumer.BucketedCounterStream.getLatest(BucketedCounterStream.java:104)
        at com.netflix.hystrix.HystrixCommandMetrics.getHealthCounts(HystrixCommandMetrics.java:370)
        at com.netflix.hystrix.HystrixCircuitBreaker$HystrixCircuitBreakerImpl.isOpen(HystrixCircuitBreaker.java:188)
        at com.netflix.hystrix.HystrixCircuitBreaker$HystrixCircuitBreakerImpl.allowRequest(HystrixCircuitBreaker.java:161)
        at com.netflix.hystrix.AbstractCommand.applyHystrixSemantics(AbstractCommand.java:509)
        at com.netflix.hystrix.AbstractCommand.access$100(AbstractCommand.java:59)
        at com.netflix.hystrix.AbstractCommand$4.call(AbstractCommand.java:405)
        at com.netflix.hystrix.AbstractCommand$4.call(AbstractCommand.java:402)
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:44)
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:33)
        at rx.Observable$2.call(Observable.java:173)
        at rx.Observable$2.call(Observable.java:166)
        at rx.Observable$2.call(Observable.java:173)
        at rx.Observable$2.call(Observable.java:166)
        at rx.Observable$2.call(Observable.java:173)
        at rx.Observable$2.call(Observable.java:166)
        at rx.Observable$2.call(Observable.java:173)
        at rx.Observable$2.call(Observable.java:166)
        at rx.Observable.unsafeSubscribe(Observable.java:8587)
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:49)
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:33)
        at rx.Observable$2.call(Observable.java:173)
        at rx.Observable$2.call(Observable.java:166)
        at rx.Observable.subscribe(Observable.java:8676)
        at rx.internal.operators.BlockingOperatorToFuture.toFuture(BlockingOperatorToFuture.java:55)
        at rx.observables.BlockingObservable.toFuture(BlockingObservable.java:420)
        at com.netflix.hystrix.HystrixCommand.queue(HystrixCommand.java:377)
        at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:343)
        at com.intuit.ems.estore.EstoreServletAPIImpl.doExecuteRequestResilient(EstoreServletAPIImpl.java:356)
        at com.intuit.ems.estore.EstoreServletAPIImpl.getAccountInfo(EstoreServletAPIImpl.java:86)
        at com.intuit.ems.dispatch.DispatcherUtil.isQBRegistered(DispatcherUtil.java:174)
        at com.intuit.ems.buy.BuySwitchDesiredActionListener.exceptionQueuingBeforePhase(BuySwitchDesiredActionListener.java:86)
        at com.intuit.ems.adapter.common.ExceptionQueuingPhaseListener.beforePhase(ExceptionQueuingPhaseListener.java:41)
        ... 43 more

【问题讨论】:

rxjava-core-0.20.3.jar?尝试不使用它。 成功了,谢谢@akarnokd 【参考方案1】:

只需要从依赖中删除“rxjava-core-0.20.3.jar”即可

【讨论】:

以上是关于hystrix java.lang.NoSuchMethodError: rx.subjects.BehaviorSubject.hasValue()Z的主要内容,如果未能解决你的问题,请参考以下文章

Hystrix入门教程

什么是Hystrix,Hystrix如何使用

0503-Hystrix保护应用-feign的hystrix支持

无法在 Hystrix 仪表板上查看 Hystrix 报告

hystrix进阶-注解hystrix-javanica使用

SpringCloud集成Hystrix