2
votes

I'm Using Jenkins and Tomcat7. if i deploy a single war file in tomcat using Jenkins it's working fine. I tried to deploy multiple different war file in tomcat one by one. first war file was deployed successfully, after that i can't deploy another war file in same tomcat folder. But i want deploy multiple .war file of different application in single tomcat folder using Jenkins.

Is it possible to deploy multiple war file in tomcat using Jenkins? If it is yes means how can i achieve? OR any other way to solve this issue?

ERROR:

Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Deployed application at context path /warttwo but context failed to start
1
How are you deploying the war files right now? And what happens during the second deploy? Do you have any error messages? - Fred Porciúncula
1.I gave destination machine tomcat username,password and URL in jenkins 2.yes i got some error message. - user3114967
Jenkins' plugin for deployment tries to access the application right after it's deployed, to make sure the deployment worked. Is your application accessible right after deploy? If you manually deploy each WAR and access each context right after deploy, would all of them work? - Fred Porciúncula
i couldn't access my apps after getting an error. - user3114967
Any help with this??\ - Pramod S. Nikam

1 Answers

1
votes

In my case:

  1. Copy all war files to one folder (Execute shell under Post Steps)

    mkdir -p wars
    rm -f wars/*
    mv app1/target/app1.war wars/
    mv app2/target/app2.war wars/

  2. Under Deploy war/ear to a container under Post-build Actions section

    WAR/EAR files: wars/*.war
    Context path: [leave empty]
    Containers -> Tomcat URL: http://localhost:8080

Then, you can visit http://localhost:8080/app1 or http://localhost:8080/app2

NOTE: The Credentials of Deploy war/ear to a container must have manager-script role so that can deploy your war files to your webapps folder in tomcat