Why Jenkins 1.598 and tomcat 8 auto-deployment do not work

I have Jenkins 1.598. I install the automatic deployment plugin in jenkins (but this is not for tomcat 8, there is no update yet).

Everything went perfectly! After the assembly is complete, it will begin redistribution. But sometimes I have such a mistake, and I do not understand when and why this happens. When I restart tomcat everything goes well!

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: test@mytest.com Finished: FAILURE 
+5
source share
1 answer

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

Here is an old Matt Mello comment (from this bug report ):

I had the same problem.

It turned out that the app4j appender was added to the HTML file in our webapp directory in the application, and, apparently, log4j did not release the file until we properly shut down the applications. Disabling the application was not enough. Perhaps this is due to the fact that log4j itself is loaded from tomcat, and not from the application? Not sure.

In any case, I added the code to the servlet kill method to clean up the appenders, and this ensured that the file was closed, so that tomcat could delete the directory.

[Don't even make me start with security issues related to what we did. This is another topic.]

Please note that speed may also write some logs to your webapp directory. In my opinion, I also saw this before.

+1
source

Source: https://habr.com/ru/post/1212083/


All Articles