ysl18721807382
ysl18721807382
采纳率0%
2015-11-25 08:31 阅读 23.8k

HTTP Status 500 - Servlet.init()

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:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
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:160)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.
请指点这是什么原因造成的哦,我在myeclipse开启tomcat就不会出现此错误

web中的配置是
<?xml version="1.0" encoding="UTF-8"?>

springmvcfirst1208
<!-- 加载spring的容器读取speing下面的配置文件 -->

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/classes/spring/applicationContext-*.xml</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<!-- springmvc前端控制器 -->

springmvc
org.springframework.web.servlet.DispatcherServlet
-->

contextConfigLocation
classpath:spring/springmvc.xml


springmvc

<url-pattern>*.action</url-pattern>

<!-- post乱码过虑器 -->

CharacterEncodingFilter
org.springframework.web.filter.CharacterEncodingFilter

encoding
utf-8



CharacterEncodingFilter
/*


index.html
index.htm
index.jsp
default.html
default.htm
default.jsp

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

14条回答 默认 最新

  • di_sheng_zhao di_sheng_zhao 2017-03-14 14:57

    把jdk换到1.7或者将引入spring4.0以后的包就行了

    点赞 4 评论 复制链接分享
  • Apple_wolf 圆师傅 2016-03-17 13:23

    同楼主遇到一样的问题了,敢问楼主是如何解决的?

    点赞 1 评论 复制链接分享
  • m0_37552947 君莫笑_JAVA 2017-05-21 06:21

    springmvc3.20一样能用,在xml中这么配置

    mvc:annotation-driven/mvc:annotation-driven
    <!-- 对于注解的Handler可以单个配置
    实际开发中建议使用组件扫描
    -->
    <!-- 可以扫描controller、service、...
    这里让扫描controller,指定controller的包
    -->
    /context:component-scan

        <!-- 视图解析器 
            解析jsp,默认使用jstl标签,classpath下边得有jstl包
        -->
        <bean 
            class="org.springframework.web.servlet.view.InternalResourceViewResolver"></bean> 
    
    点赞 1 评论 复制链接分享
  • u012427018 鼬佐 2015-11-25 08:59

    把你的web.xml文件中配置的springmvc servlet贴出来

    点赞 评论 复制链接分享
  • ysl18721807382 ysl18721807382 2015-11-25 09:29

    <?xml version="1.0" encoding="UTF-8"?>

    springmvcfirst1208
    <!-- 加载spring的容器读取speing下面的配置文件 -->

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/classes/spring/applicationContext-*.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    

    <!-- springmvc前端控制器 -->

    springmvc
    org.springframework.web.servlet.DispatcherServlet
    -->

    contextConfigLocation
    classpath:spring/springmvc.xml


    springmvc

    <url-pattern>*.action</url-pattern>
    

    <!-- post乱码过虑器 -->

    CharacterEncodingFilter
    org.springframework.web.filter.CharacterEncodingFilter

    encoding
    utf-8



    CharacterEncodingFilter
    /*


    index.html
    index.htm
    index.jsp
    default.html
    default.htm
    default.jsp

    点赞 评论 复制链接分享
  • qq_32325701 qq_32325701 2015-11-25 09:42

    *.action 你把换了。

    点赞 评论 复制链接分享
  • qq_27440821 qq_27440821 2016-08-12 08:48

    解决了吗???求分享

    点赞 评论 复制链接分享
  • qq_33829154 程序媛的成长之旅 2016-09-20 03:34

    遇到同样问题了求分享

    点赞 评论 复制链接分享
  • qq_33829154 程序媛的成长之旅 2016-09-21 10:53

    在吗?解决了吗分享一下吧

    点赞 评论 复制链接分享
  • qq_32634537 qq_32634537 2016-12-13 00:55

    求解决方法,,遇到一样的问题

    点赞 评论 复制链接分享
  • m0_37552947 君莫笑_JAVA 2017-05-21 06:24
                <!-- 使用 mvc:annotation-driven代替注解映射器和注解适配器配置,mvc:annotation-driven默认加载很多的参数绑定方法,比如json转换解析器就默认加载了,如果使用mvc:annotation-driven不用配置上边的RequestMappingHandlerMapping和RequestMappingH实际开发时使用mvc:annotation-driven-->
    
        <mvc:annotation-driven></mvc:annotation-driven> 
    
        <!-- 对于注解的Handler可以单个配置 实际开发中建议使用组件扫描-->
        <!-- 可以扫描controller、service、...这里让扫描controller,指定controller的包 -->
    
        <context:component-scan base-package="cn.jbit.ssm.controller"/>
    
        <!-- 视图解析器 解析jsp,默认使用jstl标签,classpath下边得有jstl包-->
        <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"></bean> 
    
    点赞 评论 复制链接分享
  • zhoujy0616 zhoujy0616 2017-06-19 09:52

    有个低级的原因会导致这个问题,就是,你们导入文件jar包了么
    commons-fileupload-1.2.2.jar
    commons-io-2.4.jar

    点赞 评论 复制链接分享
  • qq_37970234 End of pleasure 2017-10-29 10:03

    已经导入了
    但还是错误的求解啊

    点赞 评论 复制链接分享
  • ldb987 木子松的猫 2018-08-07 08:32

    错误的意思是“服务遇到了一个内部错误,从而导致请求没有完成”,原因可能是有一个地方少写了一个注解,导致spring扫描不到。

    点赞 评论 复制链接分享

相关推荐