我在Tomcat中授權的ssl連接有問題。我已經開發出使用證書連接到外部服務器的類。當我在命令行中運行它時,它工作正常。但是,當我把它從Tomcat中承載JSP頁面拋出異常,像這樣:收到致命警報:handshake_failure與Tomcat
error:javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174) com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136) com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1694) com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:939) com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1120) com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1147) com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1131) sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434) sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166) sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049) sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234) myPakage.myClass.method(myClass.java:90) org.apache.jsp.jsp.test.tst_jsp._jspService(tst_jsp.java:66) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:554) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) java.lang.Thread.run(Thread.java:619) Blockquote
我已經導入外部服務器的公共證書在java中的cacerts家。 Java版本:6.0_21 Tomcat版本:6.0.32
我真的很厭倦這個問題。請幫忙解決這個問題。
您是否設置了密鑰存儲?你是否正確閱讀? – bdares
您是否在Tomcat中設置了證書和https連接? – Kris
是嗎?我給類的絕對路徑密鑰庫和kaystore密碼。之後,myClass通過該參數連接到服務器 – user1006411