分类: 敏捷开发
2013-08-19 19:06:17
Jenkins部署构建工程到tomcat 7错误,错误日志如下:
ERROR: Publisher hudson.plugins.deploy.DeployPublisher aborted due to exception org.codehaus.cargo.container.ContainerException: Failed to redeploy [/usr/test/target/test.war] at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:195)at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:64)at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:90)at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:77)at hudson.FilePath.act(FilePath.java:904)at hudson.FilePath.act(FilePath.java:877)at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:77)at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:47)at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)at hudson.model.Build$BuildExecution.post2(Build.java:183)at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:726)at hudson.model.Run.execute(Run.java:1600)at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)at hudson.model.ResourceController.execute(ResourceController.java:88)at hudson.model.Executor.run(Executor.java:237)Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: (HttpURLConnection.java:1625)at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:504)at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:622)at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:635)at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:176)... 16 more java.io.IOException: Server returned HTTP response code: 403 for URL: (HttpURLConnection.java:1625) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:504) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:622) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:635) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:176) at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:64) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:90) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:77) at hudson.FilePath.act(FilePath.java:904) at hudson.FilePath.act(FilePath.java:877) at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:77) at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:47) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:726) at hudson.model.Run.execute(Run.java:1600) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:237) Finished: FAILURE
这个问题是因为对于tomcat 7的user的权限定义引起的,可查看, 摘录如下
manager-gui — Access to the HTML interface.
manager-status — Access to the "Server Status" page only.
manager-script — Access to the tools-friendly plain text interface that is described in this document, and to the "Server Status" page.
manager-jmx — Access to JMX proxy interface and to the "Server Status" page.
必须把部署用户的权限定义为“manager-script”,才可以成功部署。