Error-Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: 해결방법

CODEDRAGON Development/Spring

반응형


 

 

오류메시지

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class:

4 06, 2019 4:01:58 오전 org.springframework.context.support.AbstractApplicationContext prepareRefresh

정보: Refreshing org.springframework.context.support.

ClassPathXmlApplicationContext@5910e440: startup date [Sat Apr 06 04:01:57 KST 2019]; root of context hierarchy

4 06, 2019 4:01:58 오전 org.springframework.beans.factory.xml.

XmlBeanDefinitionReader loadBeanDefinitions

정보: Loading XML bean definitions from class path resource [appCTXch02ex11.xml]

4 06, 2019 4:01:58 오전 org.springframework.context.annotation.

ClassPathScanningCandidateComponentProvider registerDefaultFilters

정보: JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: 

Failed to read candidate component class: file [C:\CodeLa

b\git_study\study_Spring\SpringMain\target\classes\ch02\ex11\step2\Article.class]; nested exception

 is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - 

probably due to a new Java class file version that isn't supported yet: file [C:\CodeLab\git_study\study_Spring\SpringMain\target\classes\ch02\ex11\step2\Article.class]; nested exception is java.lang.IllegalArgumentException

at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.

findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:290)

at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.

doScan(ClassPathBeanDefinitionScanner.java:242)

at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.

parse(ComponentScanBeanDefinitionParser.java:84)

at org.springframework.beans.factory.xml.NamespaceHandlerSupport

.parse(NamespaceHandlerSupport.java:73)

at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.

parseCustomElement(BeanDefinitionParserDelegate.java:1438)

at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.

parseCustomElement(BeanDefinitionParserDelegate.java:1428)

at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.

parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:185)

at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.

doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)

at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.

registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerB

eanDefinitions(XmlBeanDefinitionReader.java:493)

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.

doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.

loadBeanDefinitions(XmlBeanDefinitionReader.java:334)

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.

loadBeanDefinitions(XmlBeanDefinitionReader.java:302)

at org.springframework.beans.factory.support.AbstractBeanDefinitionReader

.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)

at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.

loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)

at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.

loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)

at org.springframework.beans.factory.support.AbstractBeanDefinitionReader

.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)

at org.springframework.context.support.AbstractXmlApplicationContext.

loadBeanDefinitions(AbstractXmlApplicationContext.java:127)

at org.springframework.context.support.AbstractXmlApplicationContext.

loadBeanDefinitions(AbstractXmlApplicationContext.java:93)

at org.springframework.context.support.AbstractRefreshableApplicationContext.

refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)

at org.springframework.context.support.AbstractApplicationContext.obtainFr

eshBeanFactory(AbstractApplicationContext.java:537)

at org.springframework.context.support.

AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

at ch02.ex11.step2.BBSMain.main(BBSMain.java:12)

Caused by: org.springframework.core.NestedIOException: ASM ClassReader 

failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [C:\CodeLab\git_study\study_Spring\SpringMain\target\classes\ch02\ex11\step2\Article.class]; nested exception is java.lang.IllegalArgumentException

at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:56)

at org.springframework.core.type.classreading.

SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)

at org.springframework.core.type.classreading.

CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)

at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.

findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:266)

... 24 more

Caused by: java.lang.IllegalArgumentException

at org.springframework.asm.ClassReader.<init>(Unknown Source)

at org.springframework.asm.ClassReader.<init>(Unknown Source)

at org.springframework.asm.ClassReader.<init>(Unknown Source)

at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:53)

... 27 more

 


 


 

 

 

 

 

해결방법

pom.xml 에서

Spring Framework 버전을 3.x -> 4.x 버전이상으로 업그레이드 하면 해결됩니다.

 

<!-- Spring -->

<spring-framework.version>3.2.3.RELEASE</spring-framework.version>

<!-- Spring -->

<spring-framework.version>5.1.6.RELEASE</spring-framework.version>