Failed to read candidate component class错误分析

错误信息:

[java]  view plain  copy
  1. - JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning  
  2. - Context initialization failed  
  3. org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [E:\gold_work\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\gold_public\WEB-INF\classes\com\golddashi\base\thirdpay\rongbao\configure\RBService.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 [E:\gold_work\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\gold_public\WEB-INF\classes\com\golddashi\base\thirdpay\rongbao\configure\RBService.class]; nested exception is java.lang.IllegalArgumentException  
  4.     at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:290)  
  5.     at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242)  
  6.     at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84)  
  7.     at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)  
  8.     at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438)  
  9.     at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)  
  10.     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:185)  
  11.     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)  
  12.     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)  
  13.     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)  
  14.     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)  
  15.     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)  
  16.     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)  
  17.     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)  
  18.     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)  
  19.     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)  
  20.     at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)  
  21.     at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)  
  22.     at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)  
  23.     at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)  
  24.     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)  
  25.     at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)  
  26.     at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)  
  27.     at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)  
  28.     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4994)  
  29.     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492)  
  30.     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)  
  31.     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)  
  32.     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)  
  33.     at java.util.concurrent.FutureTask.run(Unknown Source)  
  34.     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
  35.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
  36.     at java.lang.Thread.run(Unknown Source)  
  37. 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 [E:\gold_work\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\gold_public\WEB-INF\classes\com\golddashi\base\thirdpay\rongbao\configure\RBService.class]; nested exception is java.lang.IllegalArgumentException  
  38.     at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:56)  
  39.     at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)  
  40.     at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)  
  41.     at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:266)  
  42.     ... 32 more  
  43. Caused by: java.lang.IllegalArgumentException  
  44.     at org.springframework.asm.ClassReader.<init>(Unknown Source)  
  45.     at org.springframework.asm.ClassReader.<init>(Unknown Source)  
  46.     at org.springframework.asm.ClassReader.<init>(Unknown Source)  
  47.     at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:53)  
  48.     ... 35 more  
  49. 十一月 012016 7:55:49 下午 org.apache.catalina.core.StandardContext listenerStart  
  50. 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener  
  51. org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [E:\gold_work\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\gold_public\WEB-INF\classes\com\golddashi\base\thirdpay\rongbao\configure\RBService.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 [E:\gold_work\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\gold_public\WEB-INF\classes\com\golddashi\base\thirdpay\rongbao\configure\RBService.class]; nested exception is java.lang.IllegalArgumentException  
  52.     at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:290)  
  53.     at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242)  
  54.     at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84)  
  55.     at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)  
  56.     at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438)  
  57.     at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)  
  58.     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:185)  
  59.     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)  
  60.     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)  
  61.     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)  
  62.     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)  
  63.     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)  
  64.     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)  
  65.     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)  
  66.     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)  
  67.     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)  
  68.     at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)  
  69.     at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)  
  70.     at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)  
  71.     at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)  
  72.     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)  
  73.     at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)  
  74.     at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)  
  75.     at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)  
  76.     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4994)  
  77.     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492)  
  78.     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)  
  79.     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)  
  80.     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)  
  81.     at java.util.concurrent.FutureTask.run(Unknown Source)  
  82.     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
  83.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
  84.     at java.lang.Thread.run(Unknown Source)  
  85. 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 [E:\gold_work\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\gold_public\WEB-INF\classes\com\golddashi\base\thirdpay\rongbao\configure\RBService.class]; nested exception is java.lang.IllegalArgumentException  
  86.     at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:56)  
  87.     at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)  
  88.     at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)  
  89.     at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:266)  
  90.     ... 32 more  
  91. Caused by: java.lang.IllegalArgumentException  
  92.     at org.springframework.asm.ClassReader.<init>(Unknown Source)  
  93.     at org.springframework.asm.ClassReader.<init>(Unknown Source)  
  94.     at org.springframework.asm.ClassReader.<init>(Unknown Source)  
  95.     at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:53)  
  96.     ... 35 more  
  97.   
  98. 十一月 012016 7:55:49 下午 org.apache.catalina.core.StandardContext startInternal  
  99. 严重: Error listenerStart  
  100. 十一月 012016 7:55:49 下午 org.apache.catalina.core.StandardContext startInternal  
  101. 严重: Context [/gold_public] startup failed due to previous errors  
  102. 十一月 012016 7:55:49 下午 org.apache.catalina.core.ApplicationContext log  
  103. 信息: Closing Spring root WebApplicationContext  
  104. - Closing Root WebApplicationContext: startup date [Tue Nov 01 19:55:49 GMT+08:00 2016]; root of context hierarchy  
  105. - Exception thrown from ApplicationListener handling ContextClosedEvent  
  106. java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Tue Nov 01 19:55:49 GMT+08:00 2016]; root of context hierarchy  
  107.     at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:347)  
  108.     at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)  
  109.     at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1049)  
  110.     at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)  
  111.     at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:559)  
  112.     at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)  
  113.     at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5035)  
  114.     at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5687)  
  115.     at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)  
  116.     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)  
  117.     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)  
  118.     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)  
  119.     at java.util.concurrent.FutureTask.run(Unknown Source)  
  120.     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
  121.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
  122.     at java.lang.Thread.run(Unknown Source)  
  123. - Exception thrown from LifecycleProcessor on context close  
  124. java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Tue Nov 01 19:55:49 GMT+08:00 2016]; root of context hierarchy  
  125.     at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360)  
  126.     at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1057)  
  127.     at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)  
  128.     at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:559)  
  129.     at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)  
  130.     at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5035)  
  131.     at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5687)  
  132.     at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)  
  133.     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)  
  134.     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)  
  135.     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)  
  136.     at java.util.concurrent.FutureTask.run(Unknown Source)  
  137.     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
  138.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
  139.     at java.lang.Thread.run(Unknown Source)  
  140. 十一月 012016 7:55:49 下午 org.apache.catalina.core.StandardContext listenerStop  
  141. 严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener  
  142. java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext  
  143.     at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171)  
  144.     at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1090)  
  145.     at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1064)  
  146.     at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)  
  147.     at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:559)  
  148.     at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)  
  149.     at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5035)  
  150.     at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5687)  
  151.     at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)  
  152.     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)  
  153.     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)  
  154.     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)  
  155.     at java.util.concurrent.FutureTask.run(Unknown Source)  
  156.     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
  157.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
  158.     at java.lang.Thread.run(Unknown Source)  
将spring从3.1升级到3.2启动tomcat出现如上错误,

仔细检查过web.xml中关于spring配置引入,spring-mvc配置引入都没有问题,

以及spring配置文件读取方式,包括监听参数配置也是对的,

关于引入和监听web.xml配置如下:

[html]  view plain  copy
  1. <context-param>  
  2.         <param-name>contextConfigLocation</param-name>  
  3.         <param-value>  
  4.             classpath:spring/applicationContext-spring-rmi-client.xml,  
  5.             classpath:spring/spring-context.xml  
  6.         </param-value>  
  7.     </context-param>  
  8.     <listener>  
  9.         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  
  10.     </listener>  
  11.     <listener>  
  12.         <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>  
  13.     </listener>  
换回成3.1又没有问题,换成3.2又不行,查看编译环境用的是1.8,将1.8降为1.7,问题解决,服务启动正常,

也就是说spring 3.2不支持1.8编译环境,解决办法就是降为1.7编译环境

关于编译环境配置如图:

spring官网说了,要使用java8,只支持spring 4.X以上版本,而spring的使用最低Java要求java5及以上,

如果出现例外,那就例外说了,比如一开始spring 3.1就可以在java8上编译。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值