org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration’: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource’ defined in class path resource [com/hm/study/springtest/config/DruidDBConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method ‘dataSource’ threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1354) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1204) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean 0 ( A b s t r a c t B e a n F a c t o r y . j a v a : 335 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 : 234 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 : 333 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 : 208 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . C o n s t r u c t o r R e s o l v e r . i n s t a n t i a t e U s i n g F a c t o r y M e t h o d ( C o n s t r u c t o r R e s o l v e r . j a v a : 410 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . i n s t a n t i a t e U s i n g F a c t o r y M e t h o d ( 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 : 1334 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . c r e a t e B e a n I n s t a n c e ( 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 : 1177 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 : 564 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . 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 : 524 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . l a m b d a 0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:410) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda 0(AbstractBeanFactory.java:335) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:410) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractBeanFactory.lambdadoGetBean 0 ( A b s t r a c t B e a n F a c t o r y . j a v a : 335 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 : 234 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 : 333 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 : 208 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . g e t B e a 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 : 1154 ) [ s p r i n g − c o n t e x t − 5.3.5. j a r : 5.3.5 ] 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 : 908 ) [ s p r i n g − c o n t e x t − 5.3.5. j a r : 5.3.5 ] 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 : 583 ) [ s p r i n g − c o n t e x t − 5.3.5. j a r : 5.3.5 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . w e b . s e r v l e t . c o n t e x t . S e r v l e t W e b S e r v e r 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 ( S e r v l e t W e b S e r v e r A p p l i c a t i o n C o n t e x t . j a v a : 144 ) [ s p r i n g − b o o t − 2.4.4. j a r : 2.4.4 ] 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 : 769 ) [ s p r i n g − b o o t − 2.4.4. j a r : 2.4.4 ] 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 : 761 ) [ s p r i n g − b o o t − 2.4.4. j a r : 2.4.4 ] 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 : 426 ) [ s p r i n g − b o o t − 2.4.4. j a r : 2.4.4 ] 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 : 326 ) [ s p r i n g − b o o t − 2.4.4. j a r : 2.4.4 ] 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 : 1313 ) [ s p r i n g − b o o t − 2.4.4. j a r : 2.4.4 ] 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 : 1302 ) [ s p r i n g − b o o t − 2.4.4. j a r : 2.4.4 ] a t c o m . h m . s t u d y . s p r i n g t e s t . S p r i n g b o o t T e s t A p p l i c a t i o n . m a i n ( S p r i n g b o o t T e s t A p p l i c a t i o n . j a v a : 13 ) [ c l a s s e s / : n a ] C a u s e d b y : 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 . B e a n C r e a t i o n E x c e p t i o n : E r r o r c r e a t i n g b e a n w i t h n a m e ′ d a t a S o u r c e ′ d e f i n e d i n c l a s s p a t h r e s o u r c e [ c o m / h m / s t u d y / s p r i n g t e s t / c o n f i g / D r u i d D B C o n f i g . c l a s s ] : B e a n i n s t a n t i a t i o n v i a f a c t o r y m e t h o d f a i l e d ; n e s t e d e x c e p t i o n i s o r g . s p r i n g f r a m e w o r k . b e a n s . B e a n I n s t a n t i a t i o n E x c e p t i o n : F a i l e d t o i n s t a n t i a t e [ j a v a x . s q l . D a t a S o u r c e ] : F a c t o r y m e t h o d ′ d a t a S o u r c e ′ t h r e w e x c e p t i o n ; n e s t e d e x c e p t i o n i s 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 p a c h e / l o g 4 j / L o g g e r 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 . C o n s t r u c t o r R e s o l v e r . i n s t a n t i a t e ( C o n s t r u c t o r R e s o l v e r . j a v a : 658 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . C o n s t r u c t o r R e s o l v e r . i n s t a n t i a t e U s i n g F a c t o r y M e t h o d ( C o n s t r u c t o r R e s o l v e r . j a v a : 486 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . i n s t a n t i a t e U s i n g F a c t o r y M e t h o d ( 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 : 1334 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . c r e a t e B e a n I n s t a n c e ( 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 : 1177 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 : 564 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . 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 : 524 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . l a m b d a 0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.5.jar:5.3.5] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.5.jar:5.3.5] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.5.jar:5.3.5] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.4.jar:2.4.4] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:769) [spring-boot-2.4.4.jar:2.4.4] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-2.4.4.jar:2.4.4] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) [spring-boot-2.4.4.jar:2.4.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) [spring-boot-2.4.4.jar:2.4.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313) [spring-boot-2.4.4.jar:2.4.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) [spring-boot-2.4.4.jar:2.4.4] at com.hm.study.springtest.SpringbootTestApplication.main(SpringbootTestApplication.java:13) [classes/:na] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/hm/study/springtest/config/DruidDBConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/log4j/Logger at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda 0(AbstractBeanFactory.java:335) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) [spring−context−5.3.5.jar:5.3.5]atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) [spring−context−5.3.5.jar:5.3.5]atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) [spring−context−5.3.5.jar:5.3.5]atorg.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) [spring−boot−2.4.4.jar:2.4.4]atorg.springframework.boot.SpringApplication.refresh(SpringApplication.java:769)[spring−boot−2.4.4.jar:2.4.4]atorg.springframework.boot.SpringApplication.refresh(SpringApplication.java:761)[spring−boot−2.4.4.jar:2.4.4]atorg.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)[spring−boot−2.4.4.jar:2.4.4]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:326)[spring−boot−2.4.4.jar:2.4.4]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1313)[spring−boot−2.4.4.jar:2.4.4]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1302)[spring−boot−2.4.4.jar:2.4.4]atcom.hm.study.springtest.SpringbootTestApplication.main(SpringbootTestApplication.java:13)[classes/:na]Causedby:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname′dataSource′definedinclasspathresource[com/hm/study/springtest/config/DruidDBConfig.class]:Beaninstantiationviafactorymethodfailed;nestedexceptionisorg.springframework.beans.BeanInstantiationException:Failedtoinstantiate[javax.sql.DataSource]:Factorymethod′dataSource′threwexception;nestedexceptionisjava.lang.NoClassDefFoundError:org/apache/log4j/Loggeratorg.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractBeanFactory.lambdadoGetBean 0 ( A b s t r a c t B e a n F a c t o r y . j a v a : 335 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 : 234 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 : 333 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 : 208 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . c o n f i g . D e p e n d e n c y D e s c r i p t o r . r e s o l v e C a n d i d a t e ( D e p e n d e n c y D e s c r i p t o r . j a v a : 276 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . d o R e s o l v e D e p e n d e n c y ( 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 : 1380 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . r e s o l v e D e p e n d e n c y ( 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 : 1300 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . C o n s t r u c t o r R e s o l v e r . r e s o l v e A u t o w i r e d A r g u m e n t ( C o n s t r u c t o r R e s o l v e r . j a v a : 887 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . C o n s t r u c t o r R e s o l v e r . c r e a t e A r g u m e n t A r r a y ( C o n s t r u c t o r R e s o l v e r . j a v a : 791 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] . . . 29 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 : o r g . s p r i n g f r a m e w o r k . b e a n s . B e a n I n s t a n t i a t i o n E x c e p t i o n : F a i l e d t o i n s t a n t i a t e [ j a v a x . s q l . D a t a S o u r c e ] : F a c t o r y m e t h o d ′ d a t a S o u r c e ′ t h r e w e x c e p t i o n ; n e s t e d e x c e p t i o n i s 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 p a c h e / l o g 4 j / L o g g e r 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 . S i m p l e I n s t a n t i a t i o n S t r a t e g y . i n s t a n t i a t e ( S i m p l e I n s t a n t i a t i o n S t r a t e g y . j a v a : 185 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] 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 . C o n s t r u c t o r R e s o l v e r . i n s t a n t i a t e ( C o n s t r u c t o r R e s o l v e r . j a v a : 653 ) [ s p r i n g − b e a n s − 5.3.5. j a r : 5.3.5 ] . . . 43 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 . N o C l a s s D e f F o u n d E r r o r : o r g / a p a c h e / l o g 4 j / L o g g e r a t c o m . a l i b a b a . d r u i d . f i l t e r . l o g g i n g . L o g 4 j F i l t e r . < i n i t > ( L o g 4 j F i l t e r . j a v a : 26 ) [ d r u i d − 1.1.6. j a r : 1.1.6 ] a t s u n . r e f l e c t . N a t i v e C o n s t r u c t o r A c c e s s o r I m p l . n e w I n s t a n c e 0 ( N a t i v e M e t h o d ) [ n a : 1.8. 0 7 3 ] a t s u n . r e f l e c t . N a t i v e C o n s t r u c t o r A c c e s s o r I m p l . n e w I n s t a n c e ( N a t i v e C o n s t r u c t o r A c c e s s o r I m p l . j a v a : 62 ) [ n a : 1.8. 0 7 3 ] a t s u n . r e f l e c t . D e l e g a t i n g C o n s t r u c t o r A c c e s s o r I m p l . n e w I n s t a n c e ( D e l e g a t i n g C o n s t r u c t o r A c c e s s o r I m p l . j a v a : 45 ) [ n a : 1.8. 0 7 3 ] a t j a v a . l a n g . r e f l e c t . C o n s t r u c t o r . n e w I n s t a n c e ( C o n s t r u c t o r . j a v a : 422 ) [ n a : 1.8. 0 7 3 ] a t j a v a . l a n g . C l a s s . n e w I n s t a n c e ( C l a s s . j a v a : 442 ) [ n a : 1.8. 0 7 3 ] a t c o m . a l i b a b a . d r u i d . f i l t e r . F i l t e r M a n a g e r . l o a d F i l t e r ( F i l t e r M a n a g e r . j a v a : 114 ) [ d r u i d − 1.1.6. j a r : 1.1.6 ] a t c o m . a l i b a b a . d r u i d . p o o l . D r u i d A b s t r a c t D a t a S o u r c e . a d d F i l t e r s ( D r u i d A b s t r a c t D a t a S o u r c e . j a v a : 1283 ) [ d r u i d − 1.1.6. j a r : 1.1.6 ] a t c o m . a l i b a b a . d r u i d . p o o l . D r u i d A b s t r a c t D a t a S o u r c e . s e t F i l t e r s ( D r u i d A b s t r a c t D a t a S o u r c e . j a v a : 1272 ) [ d r u i d − 1.1.6. j a r : 1.1.6 ] a t c o m . h m . s t u d y . s p r i n g t e s t . c o n f i g . D r u i d D B C o n f i g . d a t a S o u r c e ( D r u i d D B C o n f i g . j a v a : 83 ) [ c l a s s e s / : n a ] a t c o m . h m . s t u d y . s p r i n g t e s t . c o n f i g . D r u i d D B C o n f i g 0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.5.jar:5.3.5] ... 29 common frames omitted Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/log4j/Logger at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.5.jar:5.3.5] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.5.jar:5.3.5] ... 43 common frames omitted Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger at com.alibaba.druid.filter.logging.Log4jFilter.<init>(Log4jFilter.java:26) ~[druid-1.1.6.jar:1.1.6] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_73] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_73] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_73] at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_73] at java.lang.Class.newInstance(Class.java:442) ~[na:1.8.0_73] at com.alibaba.druid.filter.FilterManager.loadFilter(FilterManager.java:114) ~[druid-1.1.6.jar:1.1.6] at com.alibaba.druid.pool.DruidAbstractDataSource.addFilters(DruidAbstractDataSource.java:1283) ~[druid-1.1.6.jar:1.1.6] at com.alibaba.druid.pool.DruidAbstractDataSource.setFilters(DruidAbstractDataSource.java:1272) ~[druid-1.1.6.jar:1.1.6] at com.hm.study.springtest.config.DruidDBConfig.dataSource(DruidDBConfig.java:83) ~[classes/:na] at com.hm.study.springtest.config.DruidDBConfig 0(AbstractBeanFactory.java:335) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) [spring−beans−5.3.5.jar:5.3.5]...29commonframesomittedCausedby:org.springframework.beans.BeanInstantiationException:Failedtoinstantiate[javax.sql.DataSource]:Factorymethod′dataSource′threwexception;nestedexceptionisjava.lang.NoClassDefFoundError:org/apache/log4j/Loggeratorg.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) [spring−beans−5.3.5.jar:5.3.5]atorg.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) [spring−beans−5.3.5.jar:5.3.5]...43commonframesomittedCausedby:java.lang.NoClassDefFoundError:org/apache/log4j/Loggeratcom.alibaba.druid.filter.logging.Log4jFilter.<init>(Log4jFilter.java:26) [druid−1.1.6.jar:1.1.6]atsun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeMethod) [na:1.8.073]atsun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [na:1.8.073]atsun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [na:1.8.073]atjava.lang.reflect.Constructor.newInstance(Constructor.java:422) [na:1.8.073]atjava.lang.Class.newInstance(Class.java:442) [na:1.8.073]atcom.alibaba.druid.filter.FilterManager.loadFilter(FilterManager.java:114) [druid−1.1.6.jar:1.1.6]atcom.alibaba.druid.pool.DruidAbstractDataSource.addFilters(DruidAbstractDataSource.java:1283) [druid−1.1.6.jar:1.1.6]atcom.alibaba.druid.pool.DruidAbstractDataSource.setFilters(DruidAbstractDataSource.java:1272) [druid−1.1.6.jar:1.1.6]atcom.hm.study.springtest.config.DruidDBConfig.dataSource(DruidDBConfig.java:83) [classes/:na]atcom.hm.study.springtest.config.DruidDBConfig E n h a n c e r B y S p r i n g C G L I B EnhancerBySpringCGLIB EnhancerBySpringCGLIB a 527055 d . C G L I B a527055d.CGLIB a527055d.CGLIBdataSource 0 ( < g e n e r a t e d > ) [ c l a s s e s / : n a ] a t c o m . h m . s t u d y . s p r i n g t e s t . c o n f i g . D r u i d D B C o n f i g 0(<generated>) ~[classes/:na] at com.hm.study.springtest.config.DruidDBConfig 0(<generated>) [classes/:na]atcom.hm.study.springtest.config.DruidDBConfig E n h a n c e r B y S p r i n g C G L I B EnhancerBySpringCGLIB EnhancerBySpringCGLIB a 527055 d a527055d a527055d F a s t C l a s s B y S p r i n g C G L I B FastClassBySpringCGLIB FastClassBySpringCGLIB d 95482. i n v o k e ( < g e n e r a t e d > ) [ c l a s s e s / : n a ] a t o r g . s p r i n g f r a m e w o r k . c g l i b . p r o x y . M e t h o d P r o x y . i n v o k e S u p e r ( M e t h o d P r o x y . j a v a : 244 ) [ s p r i n g − c o r e − 5.3.5. j a r : 5.3.5 ] 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 n f i g u r a t i o n C l a s s E n h a n c e r d95482.invoke(<generated>) ~[classes/:na] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.5.jar:5.3.5] at org.springframework.context.annotation.ConfigurationClassEnhancer d95482.invoke(<generated>) [classes/:na]atorg.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) [spring−core−5.3.5.jar:5.3.5]atorg.springframework.context.annotation.ConfigurationClassEnhancerBeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.5.jar:5.3.5]
at com.hm.study.springtest.config.DruidDBConfig E n h a n c e r B y S p r i n g C G L I B EnhancerBySpringCGLIB EnhancerBySpringCGLIBa527055d.dataSource() ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_73]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_73]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.5.jar:5.3.5]
… 44 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_73]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_73]
… 64 common frames omitted
解决方案:
pom文件添加log4j依赖即可,如下所示:
log4j log4j 1.2.7