Spring Cloud中遇到的Error creating bean with name 'hystrixCommandAspect' defined in class path resource

Error starting ApplicationContext. To display the auto-configuration report re-run your application with ‘debug’ enabled.
2019-02-11 22:54:44.521 ERROR 5060 — [ main] o.s.boot.SpringApplication  : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘hystrixCommandAspect’ defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/JoinPoint
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-4.3.22.RELEASE.jar:4.3.22.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.22.RELEASE.jar:4.3.22.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory 1. g e t O b j e c t ( A b s t r a c t B e a n F a c t o r y . j a v a : 312 )   [ s p r i n g − b e a n s − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t S i n g l e t o n B e a n R e g i s t r y . g e t S i n g l e t o n ( D e f a u l t S i n g l e t o n B e a n R e g i s t r y . j a v a : 230 )   [ s p r i n g − b e a n s − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . d o G e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 308 )   [ s p r i n g − b e a n s − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . g e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 197 )   [ s p r i n g − b e a n s − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t L i s t a b l e B e a n F a c t o r y . p r e I n s t a n t i a t e S i n g l e t o n s ( D e f a u l t L i s t a b l e B e a n F a c t o r y . j a v a : 761 )   [ s p r i n g − b e a n s − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . f i n i s h B e a n F a c t o r y I n i t i a l i z a t i o n ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 867 )   [ s p r i n g − c o n t e x t − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . r e f r e s h ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 543 )   [ s p r i n g − c o n t e x t − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . e m b e d d e d . E m b e d d e d W e b A p p l i c a t i o n C o n t e x t . r e f r e s h ( E m b e d d e d W e b A p p l i c a t i o n C o n t e x t . j a v a : 124 )   [ s p r i n g − b o o t − 1.5.19. R E L E A S E . j a r : 1.5.19. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r e f r e s h ( S p r i n g A p p l i c a t i o n . j a v a : 693 ) [ s p r i n g − b o o t − 1.5.19. R E L E A S E . j a r : 1.5.19. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r e f r e s h C o n t e x t ( S p r i n g A p p l i c a t i o n . j a v a : 360 ) [ s p r i n g − b o o t − 1.5.19. R E L E A S E . j a r : 1.5.19. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r u n ( S p r i n g A p p l i c a t i o n . j a v a : 303 ) [ s p r i n g − b o o t − 1.5.19. R E L E A S E . j a r : 1.5.19. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r u n ( S p r i n g A p p l i c a t i o n . j a v a : 1118 ) [ s p r i n g − b o o t − 1.5.19. R E L E A S E . j a r : 1.5.19. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r u n ( S p r i n g A p p l i c a t i o n . j a v a : 1107 ) [ s p r i n g − b o o t − 1.5.19. R E L E A S E . j a r : 1.5.19. R E L E A S E ] a t c o m . l j r . c r o w d f u n d i n g . W e b M e m b e r A p p l i c a t i o n . m a i n ( W e b M e m b e r A p p l i c a t i o n . j a v a : 17 ) [ c l a s s e s / : n a ] C a u s e d b y : j a v a . l a n g . N o C l a s s D e f F o u n d E r r o r : o r g / a s p e c t j / l a n g / J o i n P o i n t a t j a v a . l a n g . C l a s s . g e t D e c l a r e d M e t h o d s 0 ( N a t i v e M e t h o d )   [ n a : 1.8. 0 1 72 ] a t j a v a . l a n g . C l a s s . p r i v a t e G e t D e c l a r e d M e t h o d s ( U n k n o w n S o u r c e )   [ n a : 1.8. 0 1 72 ] a t j a v a . l a n g . C l a s s . g e t D e c l a r e d M e t h o d s ( U n k n o w n S o u r c e )   [ n a : 1.8. 0 1 72 ] a t o r g . s p r i n g f r a m e w o r k . u t i l . R e f l e c t i o n U t i l s . g e t D e c l a r e d M e t h o d s ( R e f l e c t i o n U t i l s . j a v a : 612 )   [ s p r i n g − c o r e − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . u t i l . R e f l e c t i o n U t i l s . d o W i t h L o c a l M e t h o d s ( R e f l e c t i o n U t i l s . j a v a : 488 )   [ s p r i n g − c o r e − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . a n n o t a t i o n . I n i t D e s t r o y A n n o t a t i o n B e a n P o s t P r o c e s s o r . b u i l d L i f e c y c l e M e t a d a t a ( I n i t D e s t r o y A n n o t a t i o n B e a n P o s t P r o c e s s o r . j a v a : 206 )   [ s p r i n g − b e a n s − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . a n n o t a t i o n . I n i t D e s t r o y A n n o t a t i o n B e a n P o s t P r o c e s s o r . f i n d L i f e c y c l e M e t a d a t a ( I n i t D e s t r o y A n n o t a t i o n B e a n P o s t P r o c e s s o r . j a v a : 187 )   [ s p r i n g − b e a n s − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . a n n o t a t i o n . I n i t D e s t r o y A n n o t a t i o n B e a n P o s t P r o c e s s o r . p o s t P r o c e s s M e r g e d B e a n D e f i n i t i o n ( I n i t D e s t r o y A n n o t a t i o n B e a n P o s t P r o c e s s o r . j a v a : 125 )   [ s p r i n g − b e a n s − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . a n n o t a t i o n . C o m m o n A n n o t a t i o n B e a n P o s t P r o c e s s o r . p o s t P r o c e s s M e r g e d B e a n D e f i n i t i o n ( C o m m o n A n n o t a t i o n B e a n P o s t P r o c e s s o r . j a v a : 295 )   [ s p r i n g − c o n t e x t − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . a p p l y M e r g e d B e a n D e f i n i t i o n P o s t P r o c e s s o r s ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 997 )   [ s p r i n g − b e a n s − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . d o C r e a t e B e a n ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 521 )   [ s p r i n g − b e a n s − 4.3.22. R E L E A S E . j a r : 4.3.22. R E L E A S E ] . . . 15 c o m m o n f r a m e s o m i t t e d C a u s e d b y : j a v a . l a n g . C l a s s N o t F o u n d E x c e p t i o n : o r g . a s p e c t j . l a n g . J o i n P o i n t a t j a v a . n e t . U R L C l a s s L o a d e r . f i n d C l a s s ( U n k n o w n S o u r c e )   [ n a : 1.8. 0 1 72 ] a t j a v a . l a n g . C l a s s L o a d e r . l o a d C l a s s ( U n k n o w n S o u r c e )   [ n a : 1.8. 0 1 72 ] a t s u n . m i s c . L a u n c h e r 1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:124) ~[spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE] at com.ljr.crowdfunding.WebMemberApplication.main(WebMemberApplication.java:17) [classes/:na] Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/JoinPoint at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_172] at java.lang.Class.privateGetDeclaredMethods(Unknown Source) ~[na:1.8.0_172] at java.lang.Class.getDeclaredMethods(Unknown Source) ~[na:1.8.0_172] at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:612) ~[spring-core-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:488) ~[spring-core-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.buildLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:206) ~[spring-beans-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.findLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:187) ~[spring-beans-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(InitDestroyAnnotationBeanPostProcessor.java:125) ~[spring-beans-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:295) ~[spring-context-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:997) ~[spring-beans-4.3.22.RELEASE.jar:4.3.22.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-4.3.22.RELEASE.jar:4.3.22.RELEASE] ... 15 common frames omitted Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.JoinPoint at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_172] at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_172] at sun.misc.Launcher 1.getObject(AbstractBeanFactory.java:312) [springbeans4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [springbeans4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) [springbeans4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [springbeans4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) [springbeans4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) [springcontext4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) [springcontext4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:124) [springboot1.5.19.RELEASE.jar:1.5.19.RELEASE]atorg.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)[springboot1.5.19.RELEASE.jar:1.5.19.RELEASE]atorg.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)[springboot1.5.19.RELEASE.jar:1.5.19.RELEASE]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:303)[springboot1.5.19.RELEASE.jar:1.5.19.RELEASE]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1118)[springboot1.5.19.RELEASE.jar:1.5.19.RELEASE]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1107)[springboot1.5.19.RELEASE.jar:1.5.19.RELEASE]atcom.ljr.crowdfunding.WebMemberApplication.main(WebMemberApplication.java:17)[classes/:na]Causedby:java.lang.NoClassDefFoundError:org/aspectj/lang/JoinPointatjava.lang.Class.getDeclaredMethods0(NativeMethod) [na:1.8.0172]atjava.lang.Class.privateGetDeclaredMethods(UnknownSource) [na:1.8.0172]atjava.lang.Class.getDeclaredMethods(UnknownSource) [na:1.8.0172]atorg.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:612) [springcore4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:488) [springcore4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.buildLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:206) [springbeans4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.findLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:187) [springbeans4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(InitDestroyAnnotationBeanPostProcessor.java:125) [springbeans4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:295) [springcontext4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:997) [springbeans4.3.22.RELEASE.jar:4.3.22.RELEASE]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) [springbeans4.3.22.RELEASE.jar:4.3.22.RELEASE]...15commonframesomittedCausedby:java.lang.ClassNotFoundException:org.aspectj.lang.JoinPointatjava.net.URLClassLoader.findClass(UnknownSource) [na:1.8.0172]atjava.lang.ClassLoader.loadClass(UnknownSource) [na:1.8.0172]atsun.misc.LauncherAppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_172]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_172]
… 26 common frames omitted

在引入Hystrix之后,运行项目报以上的错,一开始以为是依赖下载不完整的问题,删除本地依赖几次,重新安装之后还是没有解决,Spring Boot版本为1.5.19,
pom.xml文件:



	4.0.0
	
		org.springframework.boot
		spring-boot-starter-parent
		1.5.19.RELEASE
		 
	
	com.ljr.springcloud
	WebMember
	0.0.1-SNAPSHOT
	MemberServiceClient
	Demo project for Spring Boot

	
		1.8
		Edgware.SR5
	

	
		
			org.springframework.cloud
			spring-cloud-starter-netflix-eureka-client
		
		
			org.springframework.cloud
			spring-cloud-starter-openfeign
		

		
			org.springframework.boot
			spring-boot-starter-test
			test
		
		
			org.springframework.cloud
			
				spring-cloud-starter-netflix-hystrix
			
		
		
	

	
		
			
				org.springframework.cloud
				spring-cloud-dependencies
				${spring-cloud.version}
				pom
				import
			
		
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
			
		
	

参考以下连接的回答:
https://stackoverflow.com/questions/46448051/hystrix-fallback-method-gives-error
Spring Cloud中遇到的Error creating bean with name 'hystrixCommandAspect' defined in class path resource_第1张图片

引入以下依赖解决:

		
            org.aspectj
            aspectjrt
            1.7.1
        
        
            org.aspectj
            aspectjweaver
            1.7.1
        
        
            org.springframework
            spring-aspects
        

你可能感兴趣的:(JAVA)