手动添加war包没问题,自动部署,失败,日志报错看不明白,tomcat配置已经添加
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="tomcat" password="tomcat" roles="manager-gui,manager-script,tomcat,admin-gui,admin-script"/>
报错如下,请问怎么分析定位错误,解决
Waiting for Jenkins to finish collecting data [JENKINS] Archiving C:\Users\linlazy\.jenkins\workspace\maven\pom.xml to com.demo/jfinal_demo_for_maven/3.0-SNAPSHOT/jfinal_demo_for_maven-3.0-SNAPSHOT.pom [JENKINS] Archiving C:\Users\linlazy\.jenkins\workspace\maven\target\jfinal_demo_for_maven.war to com.demo/jfinal_demo_for_maven/3.0-SNAPSHOT/jfinal_demo_for_maven-3.0-SNAPSHOT.war channel stopped Deploying C:\Users\linlazy\.jenkins\workspace\maven\target\jfinal_demo_for_maven.war to container Tomcat 7.x Remote [C:\Users\linlazy\.jenkins\workspace\maven\target\jfinal_demo_for_maven.war] is not deployed. Doing a fresh deployment. Deploying [C:\Users\linlazy\.jenkins\workspace\maven\target\jfinal_demo_for_maven.war] ERROR: Build step failed with exception org.codehaus.cargo.container.ContainerException: Failed to deploy [C:\Users\linlazy\.jenkins\workspace\maven\target\jfinal_demo_for_maven.war] at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:111) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:185) 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:996) at hudson.FilePath.act(FilePath.java:974) 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:779) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1067) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665) at hudson.model.Run.execute(Run.java:1753) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:405) Caused by: java.io.IOException: Error writing request body to server at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3518) at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3501) 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:647) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:538) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:611) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:291) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:102) ... 17 more java.io.IOException: Error writing request body to server at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3518) at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3501) 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:647) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:538) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:611) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:291) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:102) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:185) 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:996) at hudson.FilePath.act(FilePath.java:974) 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:779) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1067) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665) at hudson.model.Run.execute(Run.java:1753) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:405) Build step 'Deploy war/ear to a container' marked build as failure Finished: FAILURE
tomcat的热部署可靠性很差,建议冷部署。在jenkins实现的话你可以用脚本把war包拷贝到tomcat的webapps目录下重启tomcat
shellcopywar包到webapps,restarttomcat
回复 @linlazy:我想应该有更优雅的解决方式谢谢哈,已经这样做版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。