Jenkins自动部署时出现的一个问题

今天在部署项目的时候出现:

20:12:50 Deploying /home/deploy/.jenkins/workspace/uac-api-test/uac-api/target/uac-api.war to container Tomcat 7.x Remote
20:12:50   [/home/deploy/.jenkins/workspace/uac-api-test/uac-api/target/uac-api.war] is not deployed. Doing a fresh deployment.
20:12:50   Deploying [/home/deploy/.jenkins/workspace/uac-api-test/uac-api/target/uac-api.war]
20:12:56 Deploying /home/deploy/.jenkins/workspace/uac-api-test/uac-api/target/uac-api.war to container Tomcat 7.x Remote
20:12:56   Redeploying [/home/deploy/.jenkins/workspace/uac-api-test/uac-api/target/uac-api.war]
20:12:56   Undeploying [/home/deploy/.jenkins/workspace/uac-api-test/uac-api/target/uac-api.war]
20:12:56 ERROR: Build step failed with exception
20:12:56 org.codehaus.cargo.container.ContainerException: Failed to undeploy [/home/deploy/.jenkins/workspace/uac-api-test/uac-api/target/uac-api.war]
20:12:56    at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.undeploy(AbstractTomcatManagerDeployer.java:140)
20:12:56    at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:178)
20:12:56    at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
20:12:56    at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
20:12:56    at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
20:12:56    at hudson.FilePath.act(FilePath.java:990)
20:12:56    at hudson.FilePath.act(FilePath.java:968)
20:12:56    at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
20:12:56    at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
20:12:56    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
20:12:56    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
20:12:56    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
20:12:56    at hudson.model.Build$BuildExecution.post2(Build.java:185)
20:12:56    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
20:12:56    at hudson.model.Run.execute(Run.java:1763)
20:12:56    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
20:12:56    at hudson.model.ResourceController.execute(ResourceController.java:98)
20:12:56    at hudson.model.Executor.run(Executor.java:410)
20:12:56 Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Context /uac-api is defined in server.xml and may not be undeployed
20:12:56 
20:12:56    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:566)
20:12:56    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:480)
20:12:56    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.undeploy(TomcatManager.java:420)
20:12:56    at org.codehaus.cargo.container.tomcat.Tomcat7xRemoteDeployer.performUndeploy(Tomcat7xRemoteDeployer.java:62)
20:12:56    at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.undeploy(AbstractTomcatManagerDeployer.java:130)
20:12:56    ... 17 more
20:12:56 org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Context /uac-api is defined in server.xml and may not be undeployed
20:12:56 
20:12:56    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:566)
20:12:56    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:480)
20:12:56    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.undeploy(TomcatManager.java:420)
20:12:56    at org.codehaus.cargo.container.tomcat.Tomcat7xRemoteDeployer.performUndeploy(Tomcat7xRemoteDeployer.java:62)
20:12:56    at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.undeploy(AbstractTomcatManagerDeployer.java:130)
20:12:56    at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:178)
20:12:56    at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
20:12:56    at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
20:12:56    at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
20:12:56    at hudson.FilePath.act(FilePath.java:990)
20:12:56    at hudson.FilePath.act(FilePath.java:968)
20:12:56    at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
20:12:56    at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
20:12:56    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
20:12:56    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
20:12:56    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
20:12:56    at hudson.model.Build$BuildExecution.post2(Build.java:185)
20:12:56    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
20:12:56    at hudson.model.Run.execute(Run.java:1763)
20:12:56    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
20:12:56    at hudson.model.ResourceController.execute(ResourceController.java:98)
20:12:56    at hudson.model.Executor.run(Executor.java:410)
20:12:56 Build step 'Deploy war/ear to a container' marked build as failure
20:12:56 Sending e-mails to: kanglei@shopin.cn zhangcheng@shopin.cn
20:13:01 ERROR: 535 Error: authentication failed, system busy
20:13:01 
20:13:01 javax.mail.AuthenticationFailedException: 535 Error: authentication failed, system busy
20:13:01 
20:13:01    at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:809)
20:13:01    at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:752)
20:13:01    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:669)
20:13:01    at javax.mail.Service.connect(Service.java:317)
20:13:01    at javax.mail.Service.connect(Service.java:176)
20:13:01    at javax.mail.Service.connect(Service.java:125)
20:13:01    at javax.mail.Transport.send0(Transport.java:194)
20:13:01    at javax.mail.Transport.send(Transport.java:124)
20:13:01    at hudson.tasks.MailSender.run(MailSender.java:128)
20:13:01    at hudson.tasks.Mailer.perform(Mailer.java:170)
20:13:01    at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
20:13:01    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
20:13:01    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
20:13:01    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
20:13:01    at hudson.model.Build$BuildExecution.post2(Build.java:185)
20:13:01    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
20:13:01    at hudson.model.Run.execute(Run.java:1763)
20:13:01    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
20:13:01    at hudson.model.ResourceController.execute(ResourceController.java:98)
20:13:01    at hudson.model.Executor.run(Executor.java:410)
20:13:01 Email was triggered for: Failure - Any
20:13:01 Sending email for trigger: Failure - Any
20:13:01 An attempt to send an e-mail to empty list of recipients, ignored.
20:13:01 Finished: FAILURE
  • 解决方案:
    1、tomcat下的项目,包括work/Catalina下的文件
    2、重启服务器

原因:因为你之前删除了这个项目,但是tomcat是没有delete选项的。所以,尽管你删除了,但是在首页列表中,该项目还是存在,而实际上是不存在的。所以你无法进行部署。

以上是 网上的,自己的情况是这样的,有两台jenkins,之前是部署在A上的,后来应该一些问题想部署在B上,然后就出现了这个异常,在解决的过程中,按照这个方案没有成功,但是后来一想,自己的实例是采用Nginx进行负载均衡的,当时脑子一热只是删除了一台tomcat上面的项目,另外一台没有删除,为什么要这么做的原因还没有想清楚。

    原文作者:橙小张
    原文地址: https://www.jianshu.com/p/ab6adb5ee725
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞