Spring3.X jdk8 java.lang.IllegalArgumentException

Posted tfy1332

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring3.X jdk8 java.lang.IllegalArgumentException相关的知识,希望对你有一定的参考价值。

大象

Spring3.X jdk8 java.lang.IllegalArgumentException

 

异常提示:

 1 javax.servlet.ServletException: Servlet.init() for servlet springMVC threw exception
 2     org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
 3     org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
 4     org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
 5     org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
 6     org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
 7     org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
 8     org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)
 9     org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)
10     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
11     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
12     org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
13     java.lang.Thread.run(Thread.java:745)
14 
15 root cause
16 
17 java.lang.IllegalArgumentException
18     org.springframework.asm.ClassReader.<init>(Unknown Source)
19     org.springframework.asm.ClassReader.<init>(Unknown Source)
20     org.springframework.asm.ClassReader.<init>(Unknown Source)
21     org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:52)
22     org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
23     org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
24     org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)
25     org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:298)
26     org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:300)
27     org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:300)
28     org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:230)
29     org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:153)
30     org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:130)
31     org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:285)
32     org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)
33     org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
34     org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
35     org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:652)
36     org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:600)
37     org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:666)
38     org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:519)
39     org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:460)
40     org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
41     javax.servlet.GenericServlet.init(GenericServlet.java:158)
42     org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
43     org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
44     org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
45     org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
46     org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
47     org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
48     org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)
49     org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)
50     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
51     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
52     org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
53     java.lang.Thread.run(Thread.java:745)

解决办法:

一:把jdk版本换成1.7 or 1.7以下

二:使用spring 4.0RELEASE及以上版本

以上是关于Spring3.X jdk8 java.lang.IllegalArgumentException的主要内容,如果未能解决你的问题,请参考以下文章

Spring3.x与jdk8兼容问题

关于Spring的小问题

Spring3.x升级到Spring4.x遇到的问题及解决

升级到JDK8,编译时发生 Error:java: java.lang.ExceptionInInitializerError

JDK8 stream toMap() java.lang.IllegalStateException: Duplicate key异常解决(key重复)

报错Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/...