jenkins自动化部署war包报错Tomcat is not stopped

来源:互联网 发布:学海无涯而知也无涯 编辑:程序博客网 时间:2024/06/05 23:43

最近使用jenkins部署tomcat 的war包,实现自动化部署,在一台服务器多tomcat的情况下遇到问题,如下:

[INFO] Installing /diskc/jenkins/data/workspace/gm/target/gm.war to /root/.m2/repository/com/ge/gm/0.0.1-SNAPSHOT/gm-0.0.1-SNAPSHOT.war
[INFO] Installing /diskc/jenkins/data/workspace/gm/pom.xml to /root/.m2/repository/com/ge/gm/0.0.1-SNAPSHOT/gm-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.274 s
[INFO] Finished at: 2016-04-20T19:54:52+08:00
[INFO] Final Memory: 34M/1931M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving /diskc/jenkins/data/workspace/gm/pom.xml to com.ge/gm/0.0.1-SNAPSHOT/gm-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving /diskc/jenkins/data/workspace/gm/target/gm.war to com.ge/gm/0.0.1-SNAPSHOT/gm-0.0.1-SNAPSHOT.war
channel stopped
Starting Capitomcat Tomcat deploy
---------------------------------------------------------------------------
Capitomcat Tomcat Deploy : [Basic]
---------------------------------------------------------------------------
[192.168.9.9] Stopping Tomcat    : /opt/gm/tomcatdomain1/bin/catalina.sh stop
ERROR: Exception while executing as root@192.168.9.9: Tomcat is not stopped.

/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/capitomcat-1.2.1/lib/capitomcat/tasks/deploy.cap:115:in `check_tomcat_stopped'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/models/capitomcat/caps/capitomcat.cap:46:in `(root)'
org/jruby/RubyBasicObject.java:1738:in `instance_exec'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/sshkit-1.6.1/lib/sshkit/backends/netssh.rb:54:in `run'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/sshkit-1.6.1/lib/sshkit/runners/sequential.rb:21:in `run_backend'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/sshkit-1.6.1/lib/sshkit/runners/sequential.rb:16:in `execute'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/sshkit-1.6.1/lib/sshkit/coordinator.rb:17:in `each'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/capistrano-3.3.5/lib/capistrano/dsl.rb:55:in `on'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/models/capitomcat/caps/capitomcat.cap:20:in `(root)'
org/jruby/RubyProc.java:249:in `call'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/rake-10.4.2/lib/rake/task.rb:240:in `execute'
org/jruby/RubyArray.java:1613:in `each'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/rake-10.4.2/lib/rake/task.rb:179:in `invoke_with_call_chain'
jar:file:/diskc/jenkins/data/plugins/ruby-runtime/WEB-INF/lib/jruby-complete-1.7.3.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/capistrano-3.3.5/lib/capistrano/dsl.rb:16:in `invoke'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/models/capitomcat/capitomcat_action.rb:126:in `do_deploy'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/models/capitomcat/capitomcat_action.rb:33:in `execute'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/models/capitomcat/publisher.rb:80:in `invoke'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/models/capitomcat/publisher.rb:72:in `perform'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:14:in `perform'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:22:in `boolean_result'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:13:in `perform'

ERROR: Capitomcat deploy has failed (RuntimeError)
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/models/capitomcat/publisher.rb:85:in `invoke'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/models/capitomcat/publisher.rb:72:in `perform'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:14:in `perform'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:22:in `boolean_result'
/diskc/jenkins/data/plugins/capitomcat/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:13:in `perform'

Build step 'Deploy WAR file to Tomcat via Capitomcat' marked build as failure
Sending e-mails to:
Finished: FAILURE


分析:

从报错看,BUILD SUCCESS,但是提示Tomcat is not stopped.,因服务器部署多个tomcat,猜测是不是多个tomcat导致的问题,查看下jenkins设置的部署tomcat端口,使用的是443端口,到服务器上查看下443端口,发现有两个相关的分别是443和8443,猜测是不是jenkins使用的是模糊判断方式,443端口tomcat停止后,发现有个8443,所以提示Tomcat is not stopped.


按照这个思路判断下,将jenkins中端口设置为http协议的8009端口不使用https的443端口,再次执行部署,果然可以了。


[JENKINS] Archiving /diskc/jenkins/data/workspace/gm/pom.xml to com.ge/gm/0.0.1-SNAPSHOT/gm-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving /diskc/jenkins/data/workspace/gm/target/gm.war to com.ge/gm/0.0.1-SNAPSHOT/gm-0.0.1-SNAPSHOT.war
channel stopped
Starting Capitomcat Tomcat deploy
---------------------------------------------------------------------------
Capitomcat Tomcat Deploy : [Basic]
---------------------------------------------------------------------------
[192.168.9.9] Stopping Tomcat    : /opt/gm/tomcatdomain1/bin/catalina.sh stop
[192.168.9.9] Uploading WAR file : /diskc/jenkins/data/workspace/gm/target/gm.war => /opt/gm/tomcatdomain1/webapps/gm.war
[192.168.9.9] Cleaning-up Tomcat Work directory : /opt/gm/tomcatdomain1/work/Catalina/server05/gm
[192.168.9.9] Clean Unpacked WAR directory
[192.168.9.9] Starting Tomcat    : /opt/gm/tomcatdomain1/bin/catalina.sh start
[192.168.9.9] >>>> Complete
---------------------------------------------------------------------------
Capitomcat deploy has finished successfully
Sending e-mails to:
Finished: SUCCESS

jenkins还是不错的自动化集成工具,便于应用程序的部署工作,减轻部署的重复工作,感兴趣的朋友可以实现下。

0 0
原创粉丝点击