如何解析BeanDefinitionStoreException:从ServletContext资源[WEB-INFdispatcher-servlet.xml]解析XML文档的IOException?

如何解析BeanDefinitionStoreException:从ServletContext资源[WEB-INFdispatcher-servlet.xml]解析XML文档的IOException?,第1张

概述错误堆栈跟踪: SEVERE: StandardWrapper.Throwableorg.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/dispatcher-servlet.xml 错误堆栈跟踪:
SEVERE: StandarDWrapper.Throwableorg.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]

调度员servlet.xml中

<?xml version="1.0" enCoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xmlns:context="http://www.springframework.org/schema/context"       xmlns:p="http://www.springframework.org/schema/p"       xmlns:mvc="http://www.springframework.org/schema/mvc"       xmlns:beans="http://springframework.org/schema/beans"       xsi:schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd        http://www.springframework.org/schema/context/spring-context.xsd              http://www.springframework.org/schema/mvc/spring-mvc.xsd       http://www.springframework.org/schema/task/spring-task.xsd">    <mvc:annotation-driven/>    <context:component-scan base-package="com.exam.www" />    <!-- Factory bean that creates the Mongo instance -->    <bean ID="mongo" >        <property name="host" value="localhost" />    </bean>    <!-- MongoTemplate for connecting and quering the documents in the database -->    <bean ID="mongoTemplate" >        <constructor-arg name="mongo" ref="mongo" />        <constructor-arg name="databasename" value="Results" />    </bean>    <!-- Use this post processor to translate any MongoExceptions thrown in @Repository annotated classes -->    <bean  />    <bean ID="JspVIEwResolver"                    p:prefix="/WEB-INF/Jsp"          p:suffix=".Jsp" />   <!--   <bean />    <bean class=    "org.springframework.web.servlet.vIEw.tiles2.TilesConfigurer"> --> <!--  <property name="deFinitions">    <List>      <value>/WEB-INF/vIEws/vIEws.xml</value>    </List>  </property> </bean> --></beans>

applicationContext.xml中

<?xml version="1.0" enCoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">    <!-- Root Context: defines shared resources visible to all other web components -->    <!--        CSRF protection. Here we only include the CsrfFilter instead of all of Spring Security.        See http://docs.spring.io/spring-security/site/docs/3.2.x/reference/HTMLsingle/#csrf for more information on        Spring Security's CSRF protection    --><!--    <bean ID="csrfFilter" >        <constructor-arg>            <bean />        </constructor-arg>    </bean> -->    <!--        ProvIDes automatic CSRF token inclusion when using Spring MVC Form Tags or Thymeleaf. See        http://localhost:8080/#forms and form.Jsp for examples    -->    <!--  <bean ID="requestDataValueProcessor" />--></beans>

web.xml中

<web-app xmlns="http://java.sun.com/xml/ns/javaee"        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"        version="2.5">  <!-- <display-name>Spring With MongoDB Web Application</display-name> -->    <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>    <context-param>        <param-name>contextConfigLocation</param-name>        <param-value>WEB-INF/dispatcher-servlet.xml</param-value>    </context-param>    <welcome-file-List>       <welcome-file>/search.Jsp</welcome-file>    </welcome-file-List> </web-app>

我在网上尝试了几种解决方案
1)赋予所有文件读,写权限 – 不起作用
2)添加init-param – 不起作用
3)明确地给出dispatcherservlet的路径为/WebContent/WEB-INF/dispatcher-servlet.xml – 不起作用.

我在Apache tomcat服务器v7.0上运行项目时出现此错误

过去4天我对此问题感到震惊.请帮我.

以下是有效的解决方案.

你的战争没有dispatcher-servlet.xml. 1)项目没有webapp文件夹.使用maven创建项目时要注意.您可以按照此处提到的步骤 *** 作
http://blog.manishchhabra.com/2013/04/spring-data-mongodb-example-with-spring-mvc-3-2/
你会使用一些奇怪的maven原型创建项目.尝试上面的链接,它的工作原理.

我没有在互联网上找到其他解决方案. 总结

以上是内存溢出为你收集整理的如何解析BeanDefinitionStoreException:从ServletContext资源[/WEB-INF/dispatcher-servlet.xml]解析XML文档的IOException?全部内容,希望文章能够帮你解决如何解析BeanDefinitionStoreException:从ServletContext资源[/WEB-INF/dispatcher-servlet.xml]解析XML文档的IOException?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1135988.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存