当我运行mvn install
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>scp</id>
<phase>install</phase>
<configuration>
<tasks>
<scp file="target/somewar.war" todir="bar@foo.com:/usr/share/apache-tomcat-7.0.27/webapps"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.42</version>
</dependency>
</dependencies>
工作正常,我设法复制了war文件。然而,启动startup.sh,webapp不运行,似乎没有加载ContextListener或者似乎没有映射任何url。
INFO: Deploying web application archive /home/gohcy/apache-tomcat-7.0.34/webapps/ppdf-3party-trusted-1.0-SNAPSHOT.war
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Dec 27, 2012 8:30:34 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-80"]
我在本地tomcat的目标文件夹中使用相同的war文件时没有遇到过这样的问题。有谁知道可能是什么问题?
更新:我道歉,但似乎运行md5校验和会产生不同的结果。我的ant scp任务配置正确吗?
webapps noob$ md5 somewar.war
MD5 (somewar.war) = e9a7b263f30188df9a76c82ef9459912
[noob@PVM0 webapps]$ md5sum somewar.war
37142c9902ba9b2d6ab4138c216520e8 somewar.war
更新:重试,校验和正确,但结果相同。
我的web.xml,以防我在这里做错了。
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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_3_0.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>redirect.jsp</welcome-file>
</welcome-file-list>
</web-app>