请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

救急救急

在ssm配置中,web.xml配置如下。出现了org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]


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

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" 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>comment</display-name>

  <welcome-file-list>

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

    <welcome-file>index.htm</welcome-file>

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

    <welcome-file>default.html</welcome-file>

    <welcome-file>default.htm</welcome-file>

    <welcome-file>default.jsp</welcome-file>

  </welcome-file-list>

   

   <!-- Spring监听器 -->

  <listener>

    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

  </listener>

  

  <!--编码 -->

  <filter>

    <filter-name>CharacterEncodingFilter</filter-name>

    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

    <init-param>

      <param-name>encoding</param-name>

      <param-value>UTF-8</param-value>

    </init-param>

  </filter>

  <filter-mapping>

    <filter-name>CharacterEncodingFilter</filter-name>

    <url-pattern>/*</url-pattern>

  </filter-mapping>

  

  <!-- springmvc配置 -->

  <servlet>

    <servlet-name>spring</servlet-name>

    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

    <init-param>

      <param-name>contextConfigLocation</param-name>

      <param-value>classpath:spring/applicationContext-*.xml</param-value>

    </init-param>

    <load-on-startup>1</load-on-startup>

  </servlet>

  <servlet-mapping>

    <servlet-name>spring</servlet-name>

    <url-pattern>/</url-pattern>

  </servlet-mapping>

</web-app>


正在回答 回答被采纳积分+3

2回答

源生活 2017-08-28 18:16:15

那你在整个工程里搜一下吧,配置里没有出现【applicationContext.xml】这个文件,怎么会报这个相关的错误呢?工程里搜不到的话,找到你启动的Tomcat下部署的工程,在这里面搜,看是不是之前曾经有过,后来部署有问题,没有覆盖掉。

0 回复 有任何疑惑可以回复我~
源生活 2017-08-28 17:13:30

<param-value>classpath:spring/applicationContext-*.xml</param-value>

Could not open ServletContext resource [/WEB-INF/applicationContext.xml]

你是在哪里配的?要求有【/WEB-INF/applicationContext.xml】这么一个文件,但是这个文件并不存在。

0 回复 有任何疑惑可以回复我~
  • 提问者 田心枫 #1
    在web.xml文件中的
    ,我提问的下面有把web.xml文件复制过来
    回复 有任何疑惑可以回复我~ 2017-08-28 17:27:58
  • 提问者 田心枫 #2
    我没有配置applicationContext.xml文件
    ,我现在只是在spirng中配置了applicationContext-dao.xml//-service.xml//-web.xml
    回复 有任何疑惑可以回复我~ 2017-08-28 17:30:35

相似问题

登录后可查看更多问答,登录/注册

问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号