我在使用Spring MVC 3.2.0,Eclipse Indigo中的Tomcat 7.0.27啓動我的Webapp時出現問題。自從昨天以來一切正常。但現在看來,我的Web應用程序將無法正確部署。無法加載Webapp(Spring 3.2.0RC2,Tomcat 7.0.27)
...
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
只有
INFO消息:在類路徑
沒有檢測到春天WebApplicationInitializer類型的感覺,我認爲有部署Web應用程序
問題,當我打電話網址
localhost:80 80/myWebApp
我只看到目錄列表
我做了什麼: 我從server.xml
打消了我的Web應用程序的source
財產,我/WEB-INF/web.xml
看起來是這樣的:
<?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>
我放在servlet定義爲/WEB-INF
,看起來像這樣:
<?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>
一個項目乾淨和日食/服務器/「乾淨...」通常可以幫助像這樣的情況。 – Ralph
我通過在新的工作區中從頭開始解決了我的問題。清潔Eclipse和服務器不起作用。至少Spring在使用Annotationdriven MVC時在控制檯中給出了有關Requestmapping的反饋;)感謝lasat – dpa