spring cloud 报错Error creating bean with name 'hystrixCommandAspect' ,解决方案

spring cloud 升级到最新版 后,报错:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hystrixCommandAspect' defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect]: Factory method 'hystrixCommandAspect' threw exception; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/JoinPoint
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1128) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1023) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:751) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at com.siddharth.SpringBootHelloWorldApplication.main(SpringBootHelloWorldApplication.java:14) [classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect]: Factory method 'hystrixCommandAspect' threw exception; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/JoinPoint
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    ... 18 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/JoinPoint
    at org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration.hystrixCommandAspect(HystrixCircuitBreakerConfiguration.java:60) ~[spring-cloud-netflix-core-1.2.6.RELEASE.jar:1.2.6.RELEASE]
    at org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration$$EnhancerBySpringCGLIB$$8c1f134f.CGLIB$hystrixCommandAspect$2(<generated>) ~[spring-cloud-netflix-core-1.2.6.RELEASE.jar:1.2.6.RELEASE]
    at org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration$$EnhancerBySpringCGLIB$$8c1f134f$$FastClassBySpringCGLIB$$af9d12ee.invoke(<generated>) ~[spring-cloud-netflix-core-1.2.6.RELEASE.jar:1.2.6.RELEASE]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration$$EnhancerBySpringCGLIB$$8c1f134f.hystrixCommandAspect(<generated>) ~[spring-cloud-netflix-core-1.2.6.RELEASE.jar:1.2.6.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    ... 19 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.JoinPoint
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_112]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_112]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_112]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_112]
    ... 30 common frames omitted

解决方法:

pom文件中添加依赖:

<dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.7.1</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.7.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
        </dependency>

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏大数据文摘

微软将房间变为屏幕互动打游戏的想法,有团队成功用在了餐桌上

1724
来自专栏挖数

互联网商业模式的胡说八道

杏花村民办学校的教师王二狗是教语文的,平常除了给学生讲讲白日依山尽,黄河入海流之外,闲暇时喜欢跑村长家给他儿子辅导功课,顺便折腾折腾村里唯一一台电脑。 那是19...

3327
来自专栏顶级程序员

小猪佩奇到底有多火?数据和事实告诉你……

豆瓣评分高达9.2,素来挑剔的豆瓣用户可以给这样一部学龄前儿童动画片这么高的评分,足以表明用户对它的认可,说明其质量绝对过硬,要知道此前大火的《熊出没》、《喜洋...

892
来自专栏罗超频道

陌陌年会每人发2.5万现金,有种老板叫别人的老板

距离春节已经越来越近,相信小伙伴都已经被许多别人家的年会给“虐”了,比如大疆给几十个优秀员工送宝马车啦,再比如微信给员工每个人送一个iPhone 7 Plus啊...

2978
来自专栏灯塔大数据

原创译文 | 美国禁令后中兴不能再购买高通芯片,美国方面解释原因

转载声明 本文为灯塔大数据原创内容,欢迎个人转载至朋友圈,其他机构转载请在文章开头标注:“转自:灯塔大数据;微信:DTbigdata” 导读:中美贸易战愈演愈烈...

2585
来自专栏镁客网

「黑科技」iPhone7能“飞”起来,你敢相信吗?

1682
来自专栏VRPinea

世界杯没看过瘾?别急,NextVR给你直播国际冠军杯!

世界杯在今晚就要结束了?怎么感觉还没看过瘾呢......别急别急,这不,还有NextVR在等你!

872
来自专栏DT数据侠

魔都万套短租房数据告诉你,做个短租房东可好?

如果要评选2017年的经济热词,“共享经济”一定当仁不让。这种新的经济模式正以前所未有的速度改变城市商业的原有形态。本文的数据侠范凌、Yaung从短租房的角度入...

1350
来自专栏安恒信息

美最大黑客盗窃案主犯落网记

[摘要]该黑客团伙盗窃了1.3亿用户的信用卡信息,造成了超过3亿美元的损失。 ? 2012年6月28日,美国头号通缉网络罪犯弗拉基米尔·德林克曼和他的妻子匆匆上...

3033
来自专栏VRPinea

VR新游盘点丨元宵出门看灯会,不如宅家玩新游

33015

扫码关注云+社区