【发布时间】:2017-08-11 10:26:59
【问题描述】:
我知道问了很多次类似的问题,但我不明白哪里错了。帮我解决这个问题。我尝试使用 SpringMVC 运行我的应用程序,但我得到:
2017 年 8 月 11 日 13:06:29.471 严重 [RMI TCP 连接 (2)-127.0.0.1]
org.springframework.beans.factory.BeanDefinitionStoreException: IOException 从 ServletContext 资源解析 XML 文档 [/WEB-INF/applicationContext.xml];嵌套异常是 java.io.FileNotFoundException: 无法打开 ServletContext 资源
我在web.xmlclasspath:spring-context.xml中设置了文件路径:
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Process application servlet -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring-context.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
项目结构:
【问题讨论】: