Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file
2016-08-07 19:00 faunjoe88 阅读(3764) 评论(0) 编辑 收藏 举报springframework.version 3.2.6.RELEASE
jdk 1.8
1 [org.springframework.web.servlet.DispatcherServlet] - Context initialization failed 2 org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\jk\target\jk\WEB-INF\classes\faj\ec\jk\controller\HelloWorldController.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:\jk\target\jk\WEB-INF\classes\faj\ec\jk\controller\HelloWorldController.class]; nested exception is java.lang.IllegalArgumentException 3 at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:290) 4 at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242) 5 at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84) 6 at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73) 7 at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438) 8 at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428) 9 at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:195) 10 at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139) 11 at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108) 12 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) 13 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) 14 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) 15 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) 16 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) 17 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) 18 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) 19 at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) 20 at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) 21 at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) 22 at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537) 23 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451) 24 at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651) 25 at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599) 26 at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665) 27 at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518) 28 at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:459) 29 at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) 30 at javax.servlet.GenericServlet.init(GenericServlet.java:158) 31 at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231) 32 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144) 33 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1031) 34 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4914) 35 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5201) 36 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 37 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) 38 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) 39 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) 40 at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1648) 41 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 42 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 43 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 44 at java.lang.reflect.Method.invoke(Method.java:497) 45 at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) 46 at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) 47 at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) 48 at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:463) 49 at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:413) 50 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 51 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 52 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 53 at java.lang.reflect.Method.invoke(Method.java:497) 54 at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) 55 at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) 56 at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) 57 at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466) 58 at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) 59 at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307) 60 at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399) 61 at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:828) 62 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 63 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 64 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 65 at java.lang.reflect.Method.invoke(Method.java:497) 66 at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323) 67 at sun.rmi.transport.Transport$1.run(Transport.java:200) 68 at sun.rmi.transport.Transport$1.run(Transport.java:197) 69 at java.security.AccessController.doPrivileged(Native Method) 70 at sun.rmi.transport.Transport.serviceCall(Transport.java:196) 71 at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) 72 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) 73 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$254(TCPTransport.java:683) 74 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$1/280641652.run(Unknown Source) 75 at java.security.AccessController.doPrivileged(Native Method) 76 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) 77 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 78 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 79 at java.lang.Thread.run(Thread.java:745) 80 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:\jk\target\jk\WEB-INF\classes\faj\ec\jk\controller\HelloWorldController.class]; nested exception is java.lang.IllegalArgumentException 81 at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:56) 82 at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80) 83 at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) 84 at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:266) 85 ... 76 more 86 Caused by: java.lang.IllegalArgumentException 87 at org.springframework.asm.ClassReader.<init>(Unknown Source) 88 at org.springframework.asm.ClassReader.<init>(Unknown Source) 89 at org.springframework.asm.ClassReader.<init>(Unknown Source) 90 at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:53) 91 ... 79 more
外国同仁给出的解释:
Note that the Java 8 bytecode level (-target 1.8, as required by -source 1.8) is only fully supported as of Spring Framework 4.0. In particular,
Spring 3.2 based applications need to be compiled with a maximum of Java 7 as the target, even if they happen to be deployed onto a Java 8 runtime.
Please upgrade to Spring 4 for Java 8 based applications.
大概的意思就是java1.8版本只支持spring4.0以上,立马把pom里的sping版本换4.1.7.RELEASE就ok了,也可以把jdk调低点。