java - 在Mac上jdk8 和spring 4冲突?
PHP中文网
PHP中文网 2017-04-17 17:33:05
0
3
398

1、我在Mac上用maven编译项目,target和source是1.8,但是我在启动tomcat的时候spring报以下错误:

22:23:47.671 [RMI TCP Connection(2)-127.0.0.1] ERROR o.s.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/Users/chenzhenjia/workSpace/Java/account/ams/target/ams-1.0/WEB-INF/classes/com/ai5suoai/ams/aop/LoggingAspect.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 [/Users/chenzhenjia/workSpace/Java/account/ams/target/ams-1.0/WEB-INF/classes/com/ai5suoai/ams/aop/LoggingAspect.class]; nested exception is java.lang.IllegalArgumentException
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.__findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:290) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.reparse(ComponentScanBeanDefinitionParser.java:84) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:185) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) ~[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) ~[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.context.support.AbstractRefreshableApplicationContext.__refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:451) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) ~[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) ~[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4811) [catalina.jar:8.0.33]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5251) [catalina.jar:8.0.33]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) [catalina.jar:8.0.33]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) [catalina.jar:8.0.33]
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) [catalina.jar:8.0.33]
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) [catalina.jar:8.0.33]
    at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1696) [catalina.jar:8.0.33]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_40-release]
28-Mar-2016 22:23:47.672 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_40-release]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_40-release]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_40-release]
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) [tomcat-coyote.jar:8.0.33]
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) [na:1.8.0_40-release]
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) [na:1.8.0_40-release]
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:484) [catalina.jar:8.0.33]
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:433) [catalina.jar:8.0.33]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_40-release]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_40-release]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_40-release]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_40-release]
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) [tomcat-coyote.jar:8.0.33]
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) [na:1.8.0_40-release]
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) [na:1.8.0_40-release]
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1471) [na:1.8.0_40-release]
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) [na:1.8.0_40-release]
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1312) [na:1.8.0_40-release]
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1404) [na:1.8.0_40-release]
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:832) [na:1.8.0_40-release]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_40-release]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_40-release]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_40-release]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_40-release]
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323) [na:1.8.0_40-release]
    at sun.rmi.transport.Transport$1.run(Transport.java:200) [na:1.8.0_40-release]
    at sun.rmi.transport.Transport$1.run(Transport.java:197) [na:1.8.0_40-release]
    at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_40-release]
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196) [na:1.8.0_40-release]
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) [na:1.8.0_40-release]
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) [na:1.8.0_40-release]
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$256(TCPTransport.java:683) [na:1.8.0_40-release]
    at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_40-release]
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) [na:1.8.0_40-release]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_40-release]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_40-release]
    at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_40-release]
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 [/Users/chenzhenjia/workSpace/Java/account/ams/target/ams-1.0/WEB-INF/classes/com/ai5suoai/ams/aop/LoggingAspect.class]; nested exception is java.lang.IllegalArgumentException
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:56) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:97) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.__findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:266) ~[commons-logging-1.1.1.jar:na]
    ... 72 common frames omitted
Caused by: java.lang.IllegalArgumentException: null
    at org.springframework.asm.ClassReader.<init>(Unknown Source) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.asm.ClassReader.<init>(Unknown Source) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.asm.ClassReader.<init>(Unknown Source) ~[commons-logging-1.1.1.jar:na]
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:53) ~[commons-logging-1.1.1.jar:na]
    ... 75 common frames omitted
PHP中文网
PHP中文网

认证高级PHP讲师

membalas semua(3)
迷茫

Selesai! Ini kerana saya menggunakan spring-oxm, tetapi oxm bergantung pada pakej lain yang dipanggil castor Kerana versi pakej ini terlalu lama, ia tidak menyokong jdk8, jadi hanya padamkan spring-oxm dan kebergantungan pakej ini.

Peter_Zhu

Periksa sama ada kucing jantan anda berjalan dalam persekitaran java8.

小葫芦
  1. Semak sama ada nombor versi jvm yang menjalankan tomcat lebih tinggi daripada semasa menyusun.

  2. Maklumat pengecualian eksplisit disertakan dalam pengecualian:

    > ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet
    说明ASM的类加载器不能解释 新的class文件。可以检查当前使用的asm 包是否支持当前编译时的版本。如果不支持更换asm类库至支持的版本。
    
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan