Spring应用程序通过maven插件部署到Tomcat容器 .
我 - 我的眼睛 - 一切配置正确 . 我的应用程序将部署,但正如 Headers 所述,上下文一直无法启动 .
检查Catalina.out日志我可以看到以下消息
SEVERE [http-nio-8080-exec-6] org.springframework.web.context.ContextLoader.initWebApplicationContext上下文初始化失败org.springframework.beans.factory.BeanDefinitionStoreException:从ServletContext资源解析XML文档的IOException [/ WEB-INF / applicationContext.xml中];嵌套异常是java.io.FileNotFoundException:无法打开ServletContext资源[/WEB-INF/applicationContext.xml]
输出声明在路径:/WEB-INF/applicationContext.xml中找不到该文件,但是,我的文件是application-context.xml,位于WEB-INF / spring / application-context.xml路径 .
这也在web.xml中显式声明如下:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Younify!</display-name>
<!-- The definition of the Root Spring Container shared by all app Servlets -->
<context-param>
<param-name>contextConfiguration</param-name>
<param-value>/WEB-INF/spring/application-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>younifyapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/application-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>younifyapp</servlet-name>
<url-pattern>/youunify</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- -->
</web-app>
但是,部署时未引用此文件 . 关于我做错了什么的任何想法?非常感谢 .