gpt4 book ai didi

java - 构建步骤失败,异常 org.codehaus.cargo.container.ContainerException : Failed to redeploy

转载 作者:行者123 更新时间:2023-11-28 23:13:45 25 4
gpt4 key购买 nike

尝试使用 Jenkins 部署 WAR 时出现以下错误。

我创建了新的 Deploy-to-staging 项目,如下编辑其配置:

在我尝试构建(项目构建)代码时,Deploy-to-staging 失败,我得到

ERROR: Build step failed with exception org.codehaus.cargo.container.ContainerException: Failed to redeploy [/var/lib/jenkins/workspace/Deploy-to-staging/webapp/target/webapp.war] at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:188) 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:1077) at hudson.FilePath.act(FilePath.java:1060) 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:1844) 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: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: The username and password you provided are not correct (error 401) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:698) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:876) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:889) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:173) ... 17 more Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8090//manager/text/list at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:571) ... 20 more org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: The username and password you provided are not correct (error 401) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:698) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:876) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:889) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:173) 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:1077) at hudson.FilePath.act(FilePath.java:1060) 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:1844) 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: Server returned HTTP response code: 401 for URL: http://localhost:8090//manager/text/list at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:571) ... 20 more Build step 'Deploy war/ear to a container' marked build as failure Finished: FAILURE

我该如何解决这个问题?

我的 tomcat 凭据,位于 [tomcat 目录]/conf/tomcat-users.xml 中,如下所示:

<tomcat-users>
<role rolename="manager-script"/>
<role rolename="admin-gui"/>
<user username="tomcat" password="tomcat" roles="manager-script,admin-gui" />

最佳答案

context.xml 文件中注释标记 Valve

<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />

tomcat目录下有多个context.xml文件,更新以下context.xml文件,重启tomcat服务-

  • /apache-tomcat-8.5.41/webapps/manager/META-INF/context.xml
  • /apache-tomcat-8.5.41/webapps/host-manager/META-INF/context.xml

关于java - 构建步骤失败,异常 org.codehaus.cargo.container.ContainerException : Failed to redeploy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53314417/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com