Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why Jenkins 1.598 and tomcat 8 auto deployment does not work

Tags:

jenkins

tomcat

I have Jenkins 1.598. I install auto deployment plugin into jenkins (But it is not for tomcat 8, there is no update yet).

Everything worked fine! After build finished, it starts redeployment. But sometimes I have such error, and I do not understand when and why it happens. When I restart tomcat, everything goes again fine!

  Deploying C:\jenkins\test\target\tr-gui.war to container Tomcat 7.x Remote
      Redeploying [C:\jenkins\test\target\tr-gui.war]
      Undeploying [C:\jenkins\test\target\tr-gui.war]
    ERROR: Publisher hudson.plugins.deploy.DeployPublisher aborted due to exception
    org.codehaus.cargo.container.ContainerException: Failed to undeploy [C:\jenkins\test\target\tr-gui.war]
        at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.undeploy(AbstractTomcatManagerDeployer.java:140)
        at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:178)
        at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
        at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
        at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
        at hudson.FilePath.act(FilePath.java:981)
        at hudson.FilePath.act(FilePath.java:959)
        at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
        at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
        at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
        at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
        at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
        at hudson.model.Build$BuildExecution.post2(Build.java:183)
        at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
        at hudson.model.Run.execute(Run.java:1784)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model.ResourceController.execute(ResourceController.java:89)
        at hudson.model.Executor.run(Executor.java:240)
    Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Unable to delete [C:\servers\tomcat 8\webapps\test]. The continued presence of this file may cause problems.

        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:566)
        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:480)
        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.undeploy(TomcatManager.java:420)
        at org.codehaus.cargo.container.tomcat.Tomcat7xRemoteDeployer.performUndeploy(Tomcat7xRemoteDeployer.java:62)
        at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.undeploy(AbstractTomcatManagerDeployer.java:130)
        ... 17 more
    org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Unable to delete [C:\servers\tomcat 8\webapps\tr-gui]. The continued presence of this file may cause problems.

        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:566)
        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:480)
        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.undeploy(TomcatManager.java:420)
        at org.codehaus.cargo.container.tomcat.Tomcat7xRemoteDeployer.performUndeploy(Tomcat7xRemoteDeployer.java:62)
        at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.undeploy(AbstractTomcatManagerDeployer.java:130)
        at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:178)
        at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
        at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
        at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
        at hudson.FilePath.act(FilePath.java:981)
        at hudson.FilePath.act(FilePath.java:959)
        at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
        at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
        at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
        at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
        at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
        at hudson.model.Build$BuildExecution.post2(Build.java:183)
        at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
        at hudson.model.Run.execute(Run.java:1784)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model

.ResourceController.execute(ResourceController.java:89)
    at hudson.model.Executor.run(Executor.java:240)
Sending e-mails to:  [email protected]
Finished: FAILURE
like image 973
grep Avatar asked Nov 09 '22 19:11

grep


1 Answers

I think that at the time your test and tr-gui apps were not closed properly.

Here's an old comment by Matt Mello (from this bug report):

I had the same problem.

It turns out that we had a log4j appender setup in our app to append to an HTML file in our webapp's directory, and apparently log4j would not release the file until we properly shutdown the appenders. Shutting down the app wasn't enough. This might have been due to the fact that log4j itself is loaded from tomcat instead of from the app? Not sure.

Anyway, I added code in the servlet destroy method to cleanup the appenders and this ensured that the file was closed so that tomcat could delete the directory.

[Don't even get me started on the security issues involved in what we were doing. That is another topic.]

Note that velocity might also write some logs into your webapp's directory. I believe I have seen that before, too.

like image 150
hakamairi Avatar answered Nov 15 '22 07:11

hakamairi