Search code examples
springspring-mvctomcat7

Can't load Webapp (Spring 3.2.0RC2, Tomcat 7.0.27)


I got problems starting my Webapp using Spring MVC 3.2.0, Tomcat 7.0.27 in Eclipse Indigo. Everything worked fine since yesterday. But now it seems that my Webapp won't deploy correctly.

...
Jan 06, 2013 12:04:49 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 477 ms
Jan 06, 2013 12:04:49 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 06, 2013 12:04:49 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.27
Jan 06, 2013 12:04:50 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jan 06, 2013 12:04:51 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jan 06, 2013 12:04:51 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory <...>.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps\...
Jan 06, 2013 12:04:52 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jan 06, 2013 12:04:52 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-80"]
Jan 06, 2013 12:04:52 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jan 06, 2013 12:04:52 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jan 06, 2013 12:04:52 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2800 ms

Only the message

INFO: No Spring WebApplicationInitializer types detected on classpath

feels to me that there are problems deploying the webapp

When I call the URL

localhost:8080/myWebApp

I only see the directory listing

What I have done: I removed the source property of my webApp from the server.xml and my /WEB-INF/web.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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">

    <!-- Processes application requests -->
    <servlet>
        <servlet-name>appServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>        

    <servlet-mapping>
        <servlet-name>appServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app>

I placed the servlet-definition into /WEB-INF and it looks like that:

<?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:p="http://www.springframework.org/schema/p"
    xmlns:jms="http://www.springframework.org/schema/jms"
    xmlns:amq="http://activemq.apache.org/schema/core"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
                        http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/context 
                        http://www.springframework.org/schema/context/spring-context-3.0.xsd
                        http://www.springframework.org/schema/jms 
                        http://www.springframework.org/schema/jms/spring-jms.xsd
                        http://www.springframework.org/schema/mvc
                        http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
                        http://activemq.apache.org/schema/core 
                        http://activemq.apache.org/schema/core/activemq-core.xsd">

    <context:component-scan base-package="net.tud.vorlesung" />


    <mvc:annotation-driven />

</beans>

Solution

  • This has occurred to me when I opened a project from a upgraded IDE into a old one, So this help me to solve the issue Right Click on my project -> Maven -> Update Project...