Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redeploy a war on remote Tomcat 7 using maven-tomcat-plugin

I am trying to redeploy a war from my local machine to a remote Tomcat 7 using command prompt in Windows. I am able to upload the war with the tomcat-maven-plugin for the first time but subsequent uploads gives me a message something like this.

pom.xml

 <!-- Deploy to Remote Tomcat -->
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <url>${unix.tomcat.url}</url>
                    <server>sandbox-tomcat</server>
                    <path>/${project.artifactId}</path>
                </configuration>
            </plugin>

Maven Command:

mvn tomcat7:redeploy

Maven Log:

[INFO] Deploying war to http://secdevapp11.gspt.net:8080/istore-tax-service
Uploading: http://secdevapp11.gspt.net:8080/manager/text/deploy?path=%2Fistore-tax-service&update=true
Uploaded: http://secdevapp11.gspt.net:8080/manager/text/deploy?path=%2Fistore-tax-service&update=true (1334 KB at 512.7 KB/sec)

[INFO] tomcatManager status code:200, ReasonPhrase:OK
[INFO] FAIL - Unable to delete [/nfs/home_04/chandeln/installations/apache-tomcat-7.0.52/webapps/istore-tax-service]. The continued presence of this file may cause problems.
[INFO] FAIL - Application already exists at path /istore-tax-service
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.704s
[INFO] Finished at: Wed Mar 26 15:34:55 EDT 2014
[INFO] Final Memory: 21M/224M
[INFO] ------------------------------------------------------------------------
like image 945
Nital Avatar asked Mar 26 '14 19:03

Nital


People also ask

How to deploy WAR file on Tomcat?

Perhaps the simplest way to deploy a WAR file to Tomcat is to copy the file to Tomcat's webapps directory. Copy and paste WAR files into Tomcat's webapps directory to deploy them. Tomcat monitors this webapps directory for changes, and if it finds a new file there, it will attempt to deploy it.


1 Answers

I also had this problem. For me it worked putting in the update-tag in the tomcat-plugin

        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>     
            ... 
            <update>true</update>

            ...

and using the tomcat7:deploy command (and not 'redeploy') again.

(just noticed the answer still was there..., sorry for duplicating)

like image 60
Meru Avatar answered Nov 15 '22 09:11

Meru