context loads but fails to start

Spring application deployed to Tomcat container via maven plugin.

I have - to my eyes - everything configured correctly. My application will deploy, but as the title states the context continuously fails to start.

Checking the Catalina.out logs I can see the following message

SEVERE [http-nio-8080-exec-6] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed 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]

The output states the file cannot be found at path : /WEB-INF/applicationContext.xml, however, my file is application-context.xml, and located at the path WEB-INF/spring/application-context.xml.

This is also explicitly declared in the web.xml as follows:

<?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>

However, this file is not being referenced on deployment. Any ideas as to what I am doing wrong? Many thanks.

链接地址: http://www.djcxy.com/p/65354.html

上一篇: 从另一个项目导入应用程序上下文xml

下一篇: 上下文加载但无法启动