springmvc错误大象 Spring3.X jdk8 java.lang.IllegalArgumentException

Posted 华裳绕指柔

tags:

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

最近在学习springmvc--碰到一个特别蛋疼的错误

javax.servlet.ServletException: Servlet.init() for servlet springMVC threw exception
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)
    org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    java.lang.Thread.run(Thread.java:745)

root cause

java.lang.IllegalArgumentException
    org.springframework.asm.ClassReader.<init>(Unknown Source)
    org.springframework.asm.ClassReader.<init>(Unknown Source)
    org.springframework.asm.ClassReader.<init>(Unknown Source)
    org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:52)
    org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
    org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
    org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)
    org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:298)
    org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:300)
    org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:300)
    org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:230)
    org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:153)
    org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:130)
    org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:285)
    org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)
    org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
    org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
    org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:652)
    org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:600)
    org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:666)
    org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:519)
    org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:460)
    org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    javax.servlet.GenericServlet.init(GenericServlet.java:158)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)
    org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    java.lang.Thread.run(Thread.java:745)

错误原因:

spring3.*不能使用jdk8.0 要保证你的eclipse使用的是1.7,tomcat使用的是1.7

于是我就又安装了一个tomcat7.0,将jre改成了jre1.7

但是还是报错

于是我又安装了一个jdk1.7版本的

我心想这回改好了吧,又报下面错误

Project facet Java version 1.8 is not supported.

最后找到这篇博客解决了

使劲点我呀

 

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

SpringMVC出现406错误的解决办法

Spring3.x与jdk8兼容问题

SpringMVC Controller 返回值的可选类型

SpringMVC配置文件中读取环境变量

在猪 0.16 中加载 json 数据时,大象鸟不存在错误

Spring3.x 升级至 Spring4.x 详解