1. 程式人生 > >NoClassDefFoundError: com/netflix/hystrix/contrib/javanica/aop/aspectj/HystrixCommandAspect

NoClassDefFoundError: com/netflix/hystrix/contrib/javanica/aop/aspectj/HystrixCommandAspect

在Spring Cloud Feign工程中配置斷路器Hystrix的時候,pom.xml檔案已經加入Hystrix相關的jar:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId
>
org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId> </dependency>

Application.java:

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@EnableHystrix
@EnableHystrixDashboard
public class Application
{
public static void main(String[] args) { SpringApplication.run(Application.class, args); } }

當啟動的時候,報如下錯誤:


Exception in thread "main" java.lang.NoClassDefFoundError: com/netflix/hystrix/contrib/javanica/aop/aspectj/HystrixCommandAspect
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang
.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.getDeclaredMethods(Class.java:1975) at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613) at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524) at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510) at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:640) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:425) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:395) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:515) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:508) at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1186) at org.springframework.boot.SpringApplication.getExitCodeFromMappedException(SpringApplication.java:818) at org.springframework.boot.SpringApplication.getExitCodeFromException(SpringApplication.java:804) at org.springframework.boot.SpringApplication.handleExitCode(SpringApplication.java:790) at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:744) at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)

在pom.xml檔案中加入:

    <!-- https://mvnrepository.com/artifact/com.netflix.hystrix/hystrix-javanica -->
        <dependency>
            <groupId>com.netflix.hystrix</groupId>
            <artifactId>hystrix-javanica</artifactId>
            <version>1.5.12</version>
        </dependency>

問題解決OK!

更多系列文章推薦:

相關推薦

NoClassDefFoundError: com/netflix/hystrix/contrib/javanica/aop/aspectj/HystrixCommandAspect

在Spring Cloud Feign工程中配置斷路器Hystrix的時候,pom.xml檔案已經加入Hystrix相關的jar: <dependency> <groupId>org.spri

解決:Failed to instantiate [com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect]:

在ribbon中使用斷路器hystrix時報如下錯誤: 錯誤描述Error starting ApplicationContext. To display the auto-configuration report re-run your application with

【spring cloud】spring cloud 使用feign呼叫,1.fallback熔斷器不起作用,2.啟動報錯Caused by: java.lang.ClassNotFoundException: com.netflix.hystrix.contrib.javanica.aop.asp

1.首先使用feign呼叫,需要配置熔斷器 2.配置熔斷器需要將熔斷器注入Bean,被spring可以掃描到 3.熔斷器類需要實現feignClient介面 4.hystrix的jar需要被maven引用,並且在classpath下 5.注意,feignClient上儘量不要使用@RequestMap

關於hystrix.contrib.javanica.exception.FallbackDefinitionException: fallback method wasn't found異常

在Spring Cloud中使用斷路器後可能會遇到:com.netflix.hystrix.contrib.javanica.exception.FallbackDefinitionException: fallback method wasn't found典例如下:@Se

com.netflix.zuul.exception.ZuulException: Hystrix Readed time out

  通過API閘道器路由來訪問使用者服務,zuul預設路由規則 :http://zuul的Host地址:zuul埠/要呼叫的服務名/服務方法地址   瀏覽器中開啟http://127.0.0.1:8000/wallet/system/hello/1  報錯:  This application has no

NoClassDefFoundError: com/ibatis/sqlmap/engine/transaction/external/ExternalTransactionConfig處理

重新 lec frame -a mod tail 技術 發布 ext 根據老系統拷貝maven依賴新搭建了一個項目,啟動拋異常如下: Caused by: java.lang.NoClassDefFoundError: com/ibatis/sqlmap/engine/t

java.lang.NoClassDefFoundError: com/mchange/v2/ser/Indirector

strac listener port eval ack remote jar end anti 在使用Spring框架是報錯:java.lang.NoClassDefFoundError: com/mchange/v2/ser/Indirector java.lang.

Feign報錯Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client

nal exceptio ron source start ribbon AC server cer 問題描述 使用Feign調用微服務接口報錯,如下: java.lang.RuntimeException: com.netflix.client.ClientExcepti

netflix-hystrix-簡介[譯]

運行 AC HR 系統 分布式系 應用 彈性 會有 lba Hystrix是什麽在分布式環境下,不可避免的有一些服務會失效,Hystrix通過延遲容忍和錯誤容忍邏輯,可以控制分布式服務之間的交互。Hystrix可以隔離服務訪問入口、抑制級聯錯誤、 支持fallback,所有

netflix-hystrix-簡例

err man value nbsp together IE efault boa monit 1 /** 2 * CommandWithFallbackViaNetwork.run模擬遠程調用失敗,FallbackViaNetwork模擬需要通過網絡從Redi

java.lang.NoClassDefFoundError: com/pb/entity/TUser

maven專案,jdk1.7、tomcat7 maven結構bos-parent下面有幾個maven module.bos-entity 解決一半:bos-entity中匯入了實體類。需要右擊bos-parent  →  maven  →  updat

aop aspectj autoproxy / 的作用

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

第一個Ribbon程式Cannot access com.netflix.client.ClientFactory 編譯報錯

開發工具:idea 2018.2   pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:

spring5.0整合activity5.22報錯:java.lang.NoClassDefFoundError:com/fasterxml/jackson/databind/ObjectMapper

檢視MappingJackson2HttpMessageConverter原始碼註釋: Implementation of {@link org.springframework.http.converter.HttpMessageConverter} that can read and &nbs

異常記錄 之 nested exception is java.lang.NoClassDefFoundError: com/lowagie/text/pdf/PdfContentByte

nested exception is java.lang.NoClassDefFoundError: com/lowagie/text/pdf/PdfContentByte 在MVC 整合jasperreport 的時候.遇到一個問題,老是報 java.lang.NoClassDefFound

閘道器異常:com.netflix.zuul.exception.ZuulException: Forwarding error

 報錯資訊: [ERROR] 2018-11-14 16:02:50 [XNIO-2 task-7] c.s.u.c.s.impl.SystemLogServiceImpl - 閘道器異常 org.springframework.cloud.netflix.zuul.util.Zu

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger解決方法

今天用MailUitl工具類傳送郵件報如下錯誤。。。 錯誤提示: Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger at javax.mail.Session.

Spring 之AOP AspectJ切入點語法詳解(最全面、最詳細。)(轉)

6.5  AspectJ切入點語法詳解 6.5.1  Spring AOP支援的AspectJ切入點指示符        切入點指示符用來指示切入點表示式目的,,在spring AOP中目

spring關於nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/Inval

 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.Re

com.netflix.zuul.exception.zuulexception timeout 解決

zuul部署上之後,Zuul中預設就已經集成了Ribbon負載均衡和Hystix熔斷機制。但是所有的超時策略都是走的預設值,比如熔斷超時時間只有1S,很容易就觸發了。錯誤資訊: com.netflix.zuul.exception.ZuulException: at org.spr