简体   繁体   English

IOException解析XML文档

[英]IOException parsing XML document

    Root Cause

org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/web-inf/dispatcher-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/web-inf/dispatcher-servlet.xml]
    org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)

web.xml web.xml

    <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">


  <display-name>spring-mvc-crud-demo</display-name>

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>

  <servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>web-inf/dispatcher-servlet.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>


  <servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>


  <jsp-config>
    <jsp-property-group>
      <url-pattern>*.jsp</url-pattern>
      <page-encoding>UTF-8</page-encoding>
    </jsp-property-group>
  </jsp-config>

</web-app>

Application can't find dispatcher-servlet.xml. 应用程序找不到dispatcher-servlet.xml。 I suppose that dispatcher-servlet.xml is in correct catalog. 我猜想dispatcher-servlet.xml在正确的目录中。

目录

I have been searching stackOverFlow for a long time, but it doesn't help. 我一直在搜索stackOverFlow很长时间了,但这没有帮助。 This is very strange because it works on Windows, this problem appears on Mac. 这很奇怪,因为它在Windows上有效,而在Mac上出现此问题。

I am more used to writing WEB-INF in uppercase. 我更习惯于以大写形式编写WEB-INF。 Anyways try defining the location with a leading slash like this : 无论如何,尝试使用斜杠这样定义位置:

<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ClassPathXmlApplicationContext-BeanDefinitionStoreException:IOException解析XML文档 - ClassPathXmlApplicationContext - BeanDefinitionStoreException: IOException parsing XML document BeanDefinitionStoreException: IOException 从类路径资源 [applicationContext] 解析 XML 文档 - BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext] Spring MVC: IOException 解析来自 ServletContext 资源的 XML 文档 - Spring MVC: IOException parsing XML document from ServletContext resource IOException 从类路径资源解析 XML 文档 - IOException parsing XML document from class path resource IOException-XML解析 - IOException - XML Parsing IOException 解析来自 ServletContext 资源的 XML 文档 [/WEB-INF/spring-dispatcher-servlet.xml] - IOException parsing XML document from ServletContext resource [/WEB-INF/spring-dispatcher-servlet.xml] IOException从类路径资源解析XML文档-文件不存在-Spring - IOException parsing XML document from class path resource - file does not exist - Spring Spring org.springframework.beans.factory.BeanDefinitionStoreException:IOException从ServletContext资源解析XML文档 - Spring org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource IOException从类路径资源解析XML文档-HTTP状态500-Servlet.init() - IOException parsing XML document from class path resource - HTTP Status 500 - Servlet.init() 如何解决 BeanDefinitionStoreException: IOException 解析来自 ServletContext 资源 [/WEB-INF/dispatcher-servlet.xml] 的 XML 文档? - How to resolve BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM