在Mac上jdk8 和spring 4冲突?

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]




 

慕娘9325324
浏览 650回答 3
3回答

翻翻过去那场雪

已经解决了!是由于我用了spring-oxm 但是oxm 又依赖了另外个叫castor 的包,由于这个包的版本太旧导致不支持jdk8,所以把spring-oxm 和这个包依赖删除就好。

慕森王

检查你的tomcat是否运行在java8环境中。

慕容3067478

检查tomcat 运行的jvm版本号,是否比编译时高。异常中有明示的异常信息:> 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类库至支持的版本。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java