재밌고 어려운 IT를 이해해보자~!

BeanCreationException 본문

JAVA Error Solution

BeanCreationException

언제나즐거운IT 2024. 2. 29. 10:36

10:31:12.340 [main] WARN org.springframework.context.support.GenericXmlApplicationContext -- Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'boardDAO' defined in file [C:\JIN\workspace02\day063\target\classes\com\spring\biz\board\BoardDAO.class]: BeanPostProcessor before instantiation of bean failed

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'boardDAO' defined in file [C:\JIN\workspace02\day063\target\classes\com\spring\biz\board\BoardDAO.class]: BeanPostProcessor before instantiation of bean failed

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:959)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624)

at org.springframework.context.support.GenericXmlApplicationContext.<init>(GenericXmlApplicationContext.java:71)

at test.User03.main(User03.java:20)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Cannot create inner bean '(inner bean)#3148f668' of type [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] while setting constructor argument

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBeanValue(BeanDefinitionValueResolver.java:421)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.lambda$resolveValueIfNecessary$1(BeanDefinitionValueResolver.java:153)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:262)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:152)

at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:699)

at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:203)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1355)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1192)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)

at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:91)

at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:111)

at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip(AspectJAwareAdvisorAutoProxyCreator.java:101)

at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:280)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1130)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1105)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:511)

... 9 more

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#3148f668': Lookup method resolution failed

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.checkLookupMethods(AutowiredAnnotationBeanPostProcessor.java:497)

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:367)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1294)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1189)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBeanValue(BeanDefinitionValueResolver.java:407)

... 29 more

Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@2328c243]

at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:483)

at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:320)

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.checkLookupMethods(AutowiredAnnotationBeanPostProcessor.java:475)

... 35 more

Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/JoinPoint

at java.base/java.lang.Class.getDeclaredMethods0(Native Method)

at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)

at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504)

at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465)

... 37 more

Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.JoinPoint

at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)

at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)

... 41 more

상당히 많은 에러가 나왔다!
하지만 가장 처음에 나온 BoardDAO에서 나타난 에러는

프로그램이 순차적으로 진행하면서 거쳐올떄 가장 처음부분인 boardDAO를 거치며 발생한 에러로 

그 다음에 나오는 에러가 본체이다.

 

 

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Cannot create inner bean '(inner bean)#3148f668' of type [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] while setting constructor argument

 

AspectJ 관련 설정 이 잘되어있지 않았다!

      <dependency>
         <groupId>org.aspectj</groupId>
         <artifactId>aspectjweaver</artifactId>
      </dependency>

추가~ 이후

 

프로젝트 우클릭 -> Maven -> Update Project 

 

정상실행된다!

 

 

 

 

'JAVA Error Solution' 카테고리의 다른 글

NosearchBean  (0) 2024.02.28
java.lang.IllegalArgumentException  (0) 2024.02.07
캐쉬 저장 이슈  (2) 2024.01.28
java.lang.NullPointerException  (0) 2024.01.28
java.sql.SQLSyntaxErrorException  (0) 2024.01.28
Comments