4

I want to set up my maven built web app, to build and deploy as part of my regular job.

The build works fine, however using the container deployment plugin seems unreliable in that a fresh deployment works but redeploying the app fails. The plugin can not deploy when app is already deployed (the war is already in webapps directory). To be clear if I delete the war's and undeploy everthing and then to a jenkins build it works as expected but then subsequently they fail. The error message is :

org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Encountered exception javax.management.RuntimeErrorException: Error invoking method check

Should I instead be deploying as part of the maven build itself, using deploy:deploy and adding a distribution management section ?

Or is their a jenkins setting i am missing ?

James Jithin
  • 10,183
  • 5
  • 36
  • 51
NimChimpsky
  • 46,453
  • 60
  • 198
  • 311

5 Answers5

4

Had just the same issue. Surprisingly, completely other things helped in my case.

Looked at tomcat logs at redeploy time, and saw OutOfMemory: Permgen space. Increasing XX:PermSize and XX:MaxPermSize to 256m in $CATALINA_HOME/bin/setenv.sh solved this issue completely.

Andrey Regentov
  • 3,687
  • 4
  • 34
  • 40
1

Might also happen if you try to deploy 2 apps with the same context root in context.xml (but another defined in jenkins when deploying).

Had to manually clean /webapps and restart the server. Works again now.

icyerasor
  • 4,973
  • 1
  • 43
  • 52
1

Firstly, maven deploy plugin does not deploy a web application to a container. It deploys the project artifact to a maven repository. So, it cannot be used for your purpose.

Secondly, refer to this related open jira issue. This also suggests a solution/workaround.

Raghuram
  • 51,854
  • 11
  • 110
  • 122
  • cargo:redeploy works just fine re-deploying the war file to a remote tomcat7. I have posted the solution that worked for me as an answer. – NimChimpsky Jan 30 '12 at 12:45
  • @NimChimpsky. Sure, the link above suggests precisely the same. I felt it was important to clarify on maven deploy as well. – Raghuram Jan 31 '12 at 05:54
1

before you deploy the war file you can undeploy the existing package by using this. http://mojo.codehaus.org/tomcat-maven-plugin/undeploy-mojo.html I think you can add this task in the same job before you do the deployment.So you can still have CI as you are expecting.

Eshan Sudharaka
  • 607
  • 2
  • 9
  • 16
0

I am doing this https://stackoverflow.com/a/6524012/106261

I can either call cargo:redeploy as a post build step if I want to have deployment detail stored within pom

Or I call cargo:undeploy as a post build step, then use container deploy plugin to actually deploy using the settings I put in jenkins.

Community
  • 1
  • 1
NimChimpsky
  • 46,453
  • 60
  • 198
  • 311