実行時に、mavenantrunプラグインを使用してwarファイルをリモートの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>
正常に動作し、warファイルをコピーすることができました。ただし、startup.shを開始すると、Webアプリが実行されず、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>