之前做的一个项目,在一次系统安全检查中发现用到的tomcat7存在远程执行漏洞,要求对tomcat进行升级,然后就升级到了8.5.20版本,顺带着就把Java版本由7升级到了8,然后就出问题了!哎!能这么说也是后来解决了这个问题才理清楚了思路!真的是只有错过之后才只要对的要怎么搞!环境的问题真的好难搞!好的,简单介绍一下环境!
window7 IDE用的intellij idea 2017.1.5 jdk 1.7.0_80 tomcat 8.5.20 spring版本 3.2.0.RELEASE maven版本 apache-maven-3.3.9
这次问题的绝对真的多亏了stackoverflow;之前在csdn和博客园也查了好久,但是都没有我需要的答案,真心推荐给各位程序猿!
具体错误如下:
java.lang.IllegalArgumentException at org.springframework.asm.ClassReader.(Unknown Source) at org.springframework.asm.ClassReader.(Unknown Source) at org.springframework.asm.ClassReader.(Unknown Source) at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:52) at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80) at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101) at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76) at org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:298) at org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:300) at org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:300) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:230) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:153) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:130) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:285) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
这个错误的根本原因在
java.lang.IllegalArgumentException org.springframework.asm.ClassReader.(Unknown Source) org.springframework.asm.ClassReader.(Unknown Source) org.springframework.asm.ClassReader.(Unknown Source)
主要是因为spring版本与Java版本以对应导致的,我刚才前面提到的我一开始手痒在升级tomcat的时候对jdk也做了升级,就是这个操作导致了这个错误,这个地方需要记住两点 spring 3.X版本支持到java7 spring 4.X版本支持Java8最低支持到Java6 想了解详细情况的小猴子可以参考这篇文章:Spring Framework 4 and Java 8
日常做笔记,希望能帮助到同样问题的伙伴!
出处: