前端控制器(dispatcherServlet)Servlet初始化异常

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/HaleyLiu123/article/details/64550544

一.Servllet初始化异常

HTTP Status500 - Servlet.init() dispatcherServlet threw  exception

type Exception report

message Servlet.init() for servlet dispatcherServlet threw exception

description The server encountered an internal error that prevented it fromfulfilling this request.

exception

javax.servlet.ServletException:Servlet.init() for servlet dispatcherServlet threw exception

        org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)

        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)

     org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)

        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)

   org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)

org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)

        org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)

        org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497)

        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

org.springframework.beans.factory.BeanDefinitionStoreException:IOException parsing XML document from ServletContext resource[/WEB-INF/dispatcherServlet-servlet.xml]; nested exception isjava.io.FileNotFoundException: Could not open ServletContext resource[/WEB-INF/dispatcherServlet-servlet.xml]

org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)

org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)

org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)

org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)

org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)

org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)

org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)

org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)

org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:613)

org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:514)

org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)

org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)

org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)

org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)

   org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)

        org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)

        javax.servlet.GenericServlet.init(GenericServlet.java:158)

        org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)

        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)

     org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)

        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)

   org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)

org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)

        org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)

        org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497)

        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.io.FileNotFoundException:Could not open ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]

org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:141)

org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330)

org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)

org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)

org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)

org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)

org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)

org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)

org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)

org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:613)

org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:514)

org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)

org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)

org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)

org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)

   org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)

        org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)

        javax.servlet.GenericServlet.init(GenericServlet.java:158)

        org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)

        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)

     org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)

        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)

   org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)

org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)

        org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)

        org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497)

        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)


二.注意看Servlet.init() dispatcherServlet(dispatcherServlet初始化异常) BeanDefinitionStoreException(Bean定义异常)从ServletContext resource转换xml出现异常;从而导致文件找不到异常

必定是xml配置出了问题-------而且是配置dispatcherServlet初始化参数的时候 ;解决方案:写成 contextConfigLocation









展开阅读全文

没有更多推荐了,返回首页