英文:
How to solve javax.net.ssl.SSLHandshake Exception Error on Tomcat 7.0.100?
问题
我已将您提供的内容翻译如下:
我已将 Tomcat 版本从 7.0.53 升级至 7.0.100。部署 Tomcat 时没有错误。但是,当尝试使用 HTTPS 协议访问 URL 时,会出现 "javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure" 错误。
Java 版本:1.6.0_45
**错误日志:**
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.100] 处
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.100] 处
在 org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE] 处
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE] 处
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.100] 处
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.100] 处
在 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) [catalina.jar:7.0.100] 处
在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) [catalina.jar:7.0.100] 处
在 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:604) [catalina.jar:7.0.100] 处
在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:165) [catalina.jar:7.0.100] 处
在 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) [catalina.jar:7.0.100] 处
在 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.100] 处
在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452) [catalina.jar:7.0.100] 处
在 org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1195) [tomcat-coyote.jar:7.0.100] 处
在 org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:654) [tomcat-coyote.jar:7.0.100] 处
在 org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:319) [tomcat-coyote.jar:7.0.100] 处
在 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [na:1.6.0_45] 处
在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [na:1.6.0_45] 处
在 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.100] 处
在 java.lang.Thread.run(Thread.java:662) [na:1.6.0_45] 处
由 javax.net.ssl.SSLHandshakeException 引起:Received fatal alert: handshake_failure
在 com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174) ~[na:1.6] 处
在 com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136) ~[na:1.6] 处
在 com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1822) ~[na:1.6] 处
在 com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1004) ~[na:1.6] 处
在 com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1188) ~[na:1.6] 处
在 com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:654) ~[na:1.6] 处
在 com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:100) ~[na:1.6] 处
在 java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65) ~[na:1.6.0_45] 处
在 java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123) ~[na:1.6.0_45] 处
在 org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:828) ~[commons-httpclient-3.1.jar:na] 处
在 org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.flushRequestOutputStream(MultiThreadedHttpConnectionManager.java:1565) ~[commons-httpclient-3.1.jar:na] 处
在 org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2116) ~[commons-httpclient-3.1.jar:na] 处
在 org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096) ~[commons-httpclient-3.1.jar:na] 处
在 org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398) ~[commons-httpclient-3.1.jar:na] 处
在 org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) ~[commons-httpclient-3.1.jar:na] 处
在 org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) ~[commons-httpclient-3.1.jar:na] 处
在 org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) ~[commons-httpclient-3.1.jar:na] 处
在 org.springframework.http.client.CommonsClientHttpRequest.executeInternal(CommonsClientHttpRequest.java:85) ~[spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE] 处
在 org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:46) ~[spring-web-3.1.2.RELEASE.jar:3.1.2.RE
<details>
<summary>英文:</summary>
I have upgraded the tomcat version from 7.0.53 to 7.0.100. There is no error when deploying tomcat. but when try to access the URL with https protocol it gives "javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure".
**Java** : 1.6.0_45
Error log:
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.100]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.100]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.100]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.100]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) [catalina.jar:7.0.100]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) [catalina.jar:7.0.100]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:604) [catalina.jar:7.0.100]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:165) [catalina.jar:7.0.100]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) [catalina.jar:7.0.100]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.100]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452) [catalina.jar:7.0.100]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1195) [tomcat-coyote.jar:7.0.100]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:654) [tomcat-coyote.jar:7.0.100]
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:319) [tomcat-coyote.jar:7.0.100]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [na:1.6.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [na:1.6.0_45]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.100]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_45]
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174) ~[na:1.6]
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136) ~[na:1.6]
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1822) ~[na:1.6]
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1004) ~[na:1.6]
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1188) ~[na:1.6]
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:654) ~[na:1.6]
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:100) ~[na:1.6]
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65) ~[na:1.6.0_45]
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123) ~[na:1.6.0_45]
at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:828) ~[commons-httpclient-3.1.jar:na]
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.flushRequestOutputStream(MultiThreadedHttpConnectionManager.java:1565) ~[commons-httpclient-3.1.jar:na]
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2116) ~[commons-httpclient-3.1.jar:na]
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096) ~[commons-httpclient-3.1.jar:na]
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398) ~[commons-httpclient-3.1.jar:na]
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) ~[commons-httpclient-3.1.jar:na]
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) ~[commons-httpclient-3.1.jar:na]
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) ~[commons-httpclient-3.1.jar:na]
at org.springframework.http.client.CommonsClientHttpRequest.executeInternal(CommonsClientHttpRequest.java:85) ~[spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:46) ~[spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:49) ~[spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:446) ~[spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
**connector port in server.xml**
<Connector port="8443"
maxPostSize="8388608"
maxThreads="50"
minSpareThreads="2"
enableLookups="false"
disableUploadTimeout="true"
acceptCount="100"
scheme="https"
secure="true"
clientAuth="false"
SSLEnabled="true"
keystoreFile="${catalina.base}/conf/server.jks"
keystoreType="JKS"
keystorePass="password"
truststoreFile="${catalina.base}/conf/server.jks"
truststoreType="JKS"
truststorePass="password"
sslProtocol="TLS"
compression="force"
compressableMimeType="text/html,text/xml,text/plain,text/javascript,application/x-javascript,application/javascript,text/css"
URIEncoding="UTF-8"
server=" "
/>
What is the best way to resolve this? Thanks in advance!
</details>
# 答案1
**得分**: 1
这里的问题不是在您和Tomcat之间,而是在您的应用程序和远程调用的REST服务之间。
由于您正在使用Java 6,我猜您可能在连接到需要使用TLS 1.2的远程服务时遇到了问题。
<details>
<summary>英文:</summary>
The problem here is not between you and tomcat but between your application and the remote REST service it is invoking.
Because you are using Java 6, I guess you are having trouble connecting to a remote service that requires you to use TLS 1.2
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论