当我运行时,我正在使用 maven antrun 插件将我的战争文件 scp 到远程 tomcat 服务器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>
工作正常,我设法复制了战争文件。但是启动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>