Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-10320

Deploy Plugin fails to redeploy on Tomcat 6

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Not A Defect
    • None
    • Windows 2008 x86 32bit; Java 6; Tomcat 6; Deploy Plugin Version 1.7; Jenkins ver. 1.418

    Description

      I wanted to use the Jenkins deploy plugin to deploy my WAR on the Tomcat Server.
      I provided the Log of Jenkins and the Tomcat server

      Thanks in advance for your help
      regards Malle

      ------------------------------ Jenkins Build Stacktrace ----------------- --------------
      Deploying D:\blogic\dist\blogic.war to container Tomcat 6.x Remote
      [D:\blogic\dist\blogic.war] is not deployed. Doing a fresh deployment.
      Deploying [D:\blogic\dist\blogic.war]
      ERROR: Publisher hudson.plugins.deploy.DeployPublisher aborted due to exception
      org.codehaus.cargo.container.ContainerException: Failed to deploy [D:\blogic\dist \blogic.war]
      at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:111)
      at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:187 )
      at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:60)
      at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:86)
      at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java :73)
      at hudson.FilePath.act(FilePath.java:758)
      at hudson.FilePath.act(FilePath.java:740)
      at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:73)
      at hudson.plugins .deploy.DeployPublisher.perform(DeployPublisher.java:45)
      at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:664)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:639)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:617)
      at hudson.model.Build$RunnerImpl.post2(Build.java:161 )
      at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:586)
      at hudson.model.Run.run(Run.java:1400)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson .model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:175)
      Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Failed to deploy application at context path /blogic

      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:507)
      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:547)
      at org.codehaus .cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:273)
      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:256)
      at org.codehaus.cargo.container .tomcat.internal.TomcatManager.deploy(TomcatManager.java:240)
      at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:107)
      ... 18 more
      org.codehaus.cargo.container .tomcat.internal.TomcatManagerException: FAIL - Failed to deploy application at context path /blogic

      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:507)
      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:547)
      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:273)
      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:256)
      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:240)
      at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:107)
      at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:187)
      at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:60)
      at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:86)
      at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:73)
      at hudson.FilePath.act(FilePath.java:758)
      at hudson.FilePath.act(FilePath.java:740)
      at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:73)
      at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:45)
      at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:664)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:639)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:617)
      at hudson.model.Build$RunnerImpl.post2(Build.java:161)
      at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:586)
      at hudson.model.Run.run(Run.java:1400)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:175)
      Finished: FAILURE
      -----------------------------------------------------------

      ------------------------------ Tomcat log ---------------------
      08.07.2011 12:37:08 org.apache.coyote.http11.Http11AprProtocol pause
      INFO: Pausing Coyote HTTP/1.1 on http-8092
      08.07.2011 12:37:09 org.apache.catalina.core.StandardService stop
      INFO: Stopping service Catalina
      08.07.2011 12:37:09 org.apache.catalina.startup.HostConfig undeployApps
      WARNUNG: Error while removing context [/blogic]
      java.lang.NullPointerException
      at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:923)
      at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1357)
      at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1328)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:326)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
      at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1094)
      at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1106)
      at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:468)
      at org.apache.catalina.core.StandardService.stop(StandardService.java:604)
      at org.apache.catalina.core.StandardServer.stop(StandardServer.java:788)
      at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:408)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:338)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:416)
      08.07.2011 12:37:09 org.apache.coyote.http11.Http11AprProtocol destroy
      INFO: Stopping Coyote HTTP/1.1 on http-8092
      08.07.2011 12:37:11 org.apache.catalina.core.AprLifecycleListener init
      INFO: Loaded APR based Apache Tomcat Native library 1.1.20.
      08.07.2011 12:37:11 org.apache.catalina.core.AprLifecycleListener init
      INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
      08.07.2011 12:37:14 org.apache.coyote.http11.Http11AprProtocol init
      INFO: Initializing Coyote HTTP/1.1 on http-8092
      08.07.2011 12:37:14 org.apache.catalina.startup.Catalina load
      INFO: Initialization processed in 2819 ms
      08.07.2011 12:37:14 org.apache.catalina.core.StandardService start
      INFO: Starting service Catalina
      08.07.2011 12:37:14 org.apache.catalina.core.StandardEngine start
      INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
      08.07.2011 12:37:14 org.apache.catalina.startup.HostConfig deployDescriptor
      INFO: Deploying configuration descriptor host-manager.xml
      08.07.2011 12:37:14 org.apache.catalina.startup.HostConfig deployDescriptor
      INFO: Deploying configuration descriptor manager.xml
      08.07.2011 12:37:14 org.apache.catalina.startup.HostConfig deployWAR
      INFO: Deploying web application archive blogic.war
      08.07.2011 12:37:14 org.apache.catalina.loader.WebappClassLoader validateJarFile
      INFO: validateJarFile(D:\blogic\webapps\blogic\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
      08.07.2011 12:37:30 org.apache.catalina.startup.HostConfig deployDirectory
      INFO: Deploying web application directory docs
      08.07.2011 12:37:30 org.apache.catalina.startup.HostConfig deployDirectory
      INFO: Deploying web application directory ROOT
      08.07.2011 12:37:31 org.apache.coyote.http11.Http11AprProtocol start
      INFO: Starting Coyote HTTP/1.1 on http-8092
      08.07.2011 12:37:31 org.apache.catalina.startup.Catalina start
      INFO: Server startup in 17045 ms
      --------------------- -------------------------------------------------- ----------------------

      Attachments

        Activity

          Taken from: http://osdir.com/ml/java.cargo.user/2006-03/msg00040.html

          This error message comes from Tomcat itself, this is transparent to Cargo.
          Tomcat doesn't allow that you deploy the same application to it. If you want
          to redeploy it you need first to undeploy it using the cargo:undeploy goal.

          --> so maybe it would be fine to give a check box or so to the plugin to automatically undeploy before deploying?

          gaugusch Gerhard Gaugusch added a comment - Taken from: http://osdir.com/ml/java.cargo.user/2006-03/msg00040.html This error message comes from Tomcat itself, this is transparent to Cargo. Tomcat doesn't allow that you deploy the same application to it. If you want to redeploy it you need first to undeploy it using the cargo:undeploy goal. --> so maybe it would be fine to give a check box or so to the plugin to automatically undeploy before deploying?
          dermoritz mo loe added a comment -

          same problem here (tomcat7). but it works several times. normally the plugin tries to undeploy the app before deploying it again. but sometimes it fails on different stages: undeploy (can't delete the folder), deploy (hangs or deploys with error).
          in all cases restarting tomcat and run deploy plugin again works fine.
          I think a good solution would be an option that stop tomcat before undeploying (deleting the folder and war), starting tomcat and then deploy?!

          dermoritz mo loe added a comment - same problem here (tomcat7). but it works several times. normally the plugin tries to undeploy the app before deploying it again. but sometimes it fails on different stages: undeploy (can't delete the folder), deploy (hangs or deploys with error). in all cases restarting tomcat and run deploy plugin again works fine. I think a good solution would be an option that stop tomcat before undeploying (deleting the folder and war), starting tomcat and then deploy?!
          mmello Matt Mello added a comment -

          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.

          mmello Matt Mello added a comment - 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.
          evernat evernat added a comment -

          The initial issue is not an issue in Jenkins or in the deploy plugin.
          It is an issue coming from Tomcat:
          "Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Failed to deploy application at context path /blogic"

          and in Tomcat log:
          INFO: Deploying web application archive blogic.war
          08.07.2011 12:37:14 org.apache.catalina.loader.WebappClassLoader validateJarFile
          INFO: validateJarFile(D:\blogic\webapps\blogic\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

          So this was probably a problem in the war file of the webapp (servlet-api.jar should not be included in the war file).

          The other cases given in the comments were about problems when Tomcat undeploys, for example with resources and files not closed by the webapp: in fact, the webapp should properly close resources in a "destroy" method.

          So resolving this issue as "not a defect".

          evernat evernat added a comment - The initial issue is not an issue in Jenkins or in the deploy plugin. It is an issue coming from Tomcat: "Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Failed to deploy application at context path /blogic" and in Tomcat log: INFO: Deploying web application archive blogic.war 08.07.2011 12:37:14 org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(D:\blogic\webapps\blogic\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class So this was probably a problem in the war file of the webapp (servlet-api.jar should not be included in the war file). The other cases given in the comments were about problems when Tomcat undeploys, for example with resources and files not closed by the webapp: in fact, the webapp should properly close resources in a "destroy" method. So resolving this issue as "not a defect".

          try with user having manager-script role in tomcat-user.xml file , Make sure to restart the tomcat server after change.

          This worked for me.

          dshrivastava Dipanshu Shrivastava added a comment - try with user having manager-script role in tomcat-user.xml file , Make sure to restart the tomcat server after change. This worked for me.

          People

            Unassigned Unassigned
            siemalc Malcom Siem
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: