代码之家  ›  专栏  ›  技术社区  ›  Almas Abdrazak

詹金斯第二次未能向Tomcat容器部署战争

  •  0
  • Almas Abdrazak  · 技术社区  · 5 年前

    我想用詹金斯把战争文件部署到Tomcat 8, enter image description here

    它部署成功,但当我按下 立即生成 第二次显示以下错误

    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 9.223 s
    [INFO] Finished at: 2019-03-14T08:15:26+01:00
    [INFO] Final Memory: 59M/755M
    [INFO] ------------------------------------------------------------------------
    Deploying /var/lib/jenkins/workspace/staker-dev/target/tech.staker-site.war to container Tomcat 8.x Remote with context ROOT
      [/var/lib/jenkins/workspace/mybuild/target/tech.staker-site.war] is not deployed. Doing a fresh deployment.
      Deploying [/var/lib/jenkins/workspace/bybuild/target/tech.staker-site.war]
    ERROR: Build step failed with exception
    org.codehaus.cargo.container.ContainerException: Failed to deploy [/var/lib/jenkins/workspace/myBuild/target/tech.staker-site.war]
        at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:110)
        at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:184)
        at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:77)
        at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:147)
        at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:117)
        at hudson.FilePath.act(FilePath.java:1078)
        at hudson.FilePath.act(FilePath.java:1061)
        at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:114)
        at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeploy(PasswordProtectedAdapterCargo.java:93)
        at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:64)
        at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
        at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
        at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
        at hudson.model.Build$BuildExecution.post2(Build.java:186)
        at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
        at hudson.model.Run.execute(Run.java:1835)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model.ResourceController.execute(ResourceController.java:97)
        at hudson.model.Executor.run(Executor.java:429)
    Caused by: java.io.IOException: Error writing request body to server
        at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3587)
        at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3570)
        at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
        at java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)
        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.pipe(TomcatManager.java:821)
        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:568)
        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:761)
        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:312)
        at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:101)
        ... 18 more
    java.io.IOException: Error writing request body to server
        at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3587)
        at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3570)
        at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
        at java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)
        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.pipe(TomcatManager.java:821)
        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:568)
        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:761)
        at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:312)
        at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:101)
        at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:184)
        at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:77)
        at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:147)
        at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:117)
        at hudson.FilePath.act(FilePath.java:1078)
        at hudson.FilePath.act(FilePath.java:1061)
        at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:114)
        at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeploy(PasswordProtectedAdapterCargo.java:93)
        at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:64)
        at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
        at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
        at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
        at hudson.model.Build$BuildExecution.post2(Build.java:186)
        at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
        at hudson.model.Run.execute(Run.java:1835)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model.ResourceController.execute(ResourceController.java:97)
        at hudson.model.Executor.run(Executor.java:429)
    Build step 'Deploy war/ear to a container' marked build as failure
    

    为了解决这个问题,我删除webapp目录中的根文件夹,然后重新启动tomcat,这样部署工作正常,但只有在根文件夹不存在的情况下。我认为Jenkins不能重新部署同一个应用程序,原因是什么?

    0 回复  |  直到 5 年前
        1
  •  1
  •   Almas Abdrazak    5 年前

    我终于找到了答案

    在生成后操作更改中

    1)WAR/EAR文件-> **/*.war 而不是 目标/名称.war

    2)上下文路径-> / 而不是 ROOT

    别忘了创建管理器GUI(在我的例子中,它是被配置的,但我在堆栈中发现了很多问题,人们没有配置管理器GUI)