关于springmvc注解扫描报错500的解决方案

HTTP Status 500 - Servlet.init() for servlet springmvc threw exception

type Exception report
message Servlet.init() for servlet springmvc threw exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet.init() for servlet springmvc threw exception
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	java.lang.Thread.run(Thread.java:745)
root cause
java.lang.IllegalArgumentException
	org.springframework.asm.ClassReader.(Unknown Source)
	org.springframework.asm.ClassReader.(Unknown Source)
	org.springframework.asm.ClassReader.(Unknown Source)
	org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:52)
	org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
	org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101)
	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:647)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
	javax.servlet.GenericServlet.init(GenericServlet.java:158)
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	java.lang.Thread.run(Thread.java:745)


这个错误找得真不容易.............终于解决了。
解决方案:
原因:JDK1.8和tomcat以及spring版本的不兼容问题,因此就会产生这样的错误。
网上的解决方法是: 1、将jdk版本降低到1.7一下,
2、将springmvc版本升级到4.0
3、还有一种说法是tomcat的jre包导致。
最后,我的解决方法是:
因为我之前用的Spring包是3.2,将所有spring包全部换成4.0完美解决!!!!!!!!!!!!!!!!
功夫不负有心人啊!!!!!!!!

你可能感兴趣的:(关于springmvc注解扫描报错500的解决方案)