Jenkins通过https向tomcat部署战争

时间:2018-03-17 05:57:39

标签: jenkins jenkins-plugins tomcat8

我尝试通过Jenkins 部署到容器插件将war文件部署到远程计算机,并且成功了。 tomcat网址为http://hostname:8080/。后来我们在tomcat服务器上启用了SSL。现在,tomcat URL为https://hostname:8443。将war文件推送到此启用SSL的tomcat服务器,现在失败,出现以下异常。在JENKINS部署到容器插件上没有关于SSL证书的选项。

    Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:534)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:686)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:699)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:174)

1 个答案:

答案 0 :(得分:1)

我首先移动了我的cacerts文件,以确保Jenkins实际上尝试访问该文件。 在我批准Jenkins使用此文件后,我使用Portecle在我的cacerts中查看我的所有证书,然后导入了丢失的证书:

How to properly import a selfsigned certificate into Java keystore that is available to all Java applications by default?

由于我仍然遇到同样的错误,我意识到我忘了导入服务器本身的证书。我在jenkins.xml中找到了我的证书(我的tomcat和Jenkins在同一台服务器上运行)并将它放在我的cacerts和我的其他.jks文件中。

保存并重新启动所有服务后,它终于为我工作了。