当前位置: 首页 > 知识库问答 >
问题:

Java 1.8和tomcat 6.0.53的原因是:Java。木卫一。EOFEException:SSL对等端错误关闭

贺栋
2023-03-14
java -cp catalina.jar org.apache.catalina.util.ServerInfo
Server version: Apache Tomcat/6.0.53
Server built:   Apr 19 2017 22:34:06 UTC
Server number:  6.0.53.0
OS Name:        Linux
OS Version:     4.1.7-15.23.amzn1.x86_64
Architecture:   amd64
JVM Version:    1.8.0_171-b10
JVM Vendor:     Oracle Corporation

当我在独立java代码中运行相同的代码时,我会得到响应,而当我在web应用中运行时,我会得到这个错误。

Java 1.8和tomcat 6.0.53的原因是:Java。木卫一。EOFEException:SSL对等端错误关闭

代码:

HttpClient httpclient = HttpClientBuilder.create().build();
//        HttpClient httpclient = buildInfoPayHttpClient();
//        if (httpclient == null) {
//            return null;
//        }
        try {
            StringBuilder sb = new StringBuilder();
            sb.append(FlintoUtils.getPayUFetchUrl());

            List<NameValuePair> postParameters =  new ArrayList<NameValuePair>();
            postParameters.add(new BasicNameValuePair("key", FlintoUtils.getPayuMerchantKey()));
            postParameters.add(new BasicNameValuePair("command", "verify_payment"));
            postParameters.add(new BasicNameValuePair("hash", hash));
            postParameters.add(new BasicNameValuePair("var1", orderId.toString()));

            HttpPost httppost = new HttpPost(sb.toString());
            httppost.setEntity(new UrlEncodedFormEntity(postParameters));

            HttpResponse response = httpclient.execute(httppost);

            _log.warn(orderId.toString() + " Url:"+FlintoUtils.getPayUFetchUrl() + " Response: " + response.toString());

            // Get hold of the response entity
            HttpEntity outputEntity = response.getEntity();

            // If the response does not enclose an entity, there is no need
            // to worry about connection release
            if (outputEntity != null) {
                try {
                    String output = EntityUtils.toString(outputEntity);
                    _log.warn("output for order:" +orderId + "  is:" +output);
                    JSONObject jsonObject = new JSONObject(output);
                    return jsonObject;

                } catch (Exception ex) {
                    _log.error("Exception in fetchPayuStatus: " , ex);
                    throw ex;

                } 
            }
        } catch (Exception e) {
           _log.error("Exception in fetchPayuStatus: " , e);
        } 
        return null;


javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
            at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:963)
            at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1342)
            at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1369)
            at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1353)
            at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:275)
            at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:254)
            at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
            at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
            at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
            at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
            at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
            at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
            at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
            at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
            at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
            at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
            at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
            at com.flinto.core.admin.WebClientUtility.fetchPayuStatus(WebClientUtility.java:377)
            at com.flinto.web.controller.CreateOrderAdminController.updateOrderPaymentStatus(CreateOrderAdminController.java:849)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
            at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
            at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:100)
            at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:604)
            at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:565)
            at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
            at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
            at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
            at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at com.flinto.web.utils.WebCommon.urlRedirectByAccessRole(WebCommon.java:402)
            at com.flinto.web.filter.UrlRedirectionFilter.doFilter(UrlRedirectionFilter.java:37)
            at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
            at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:322)
            at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
            at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
            at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
            at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
            at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
            at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
            at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
            at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
            at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
            at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
            at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:144)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
            at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:184)
            at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:155)
            at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
            at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at com.flinto.web.filter.ApexDomainRedirectFilter.doFilter(ApexDomainRedirectFilter.java:37)
            at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
            at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
            at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:652)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
            at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:883)
            at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:756)
            at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2391)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
            at java.lang.Thread.run(Thread.java:748)
    Caused by: java.io.EOFException: SSL peer shut down incorrectly
            at sun.security.ssl.InputRecord.read(InputRecord.java:482)
            at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:944)
            ... 92 more

共有2个答案

楚皓君
2023-03-14

最后我在一个朋友的帮助下解决了这个问题。我们能够调试并指出启用SSL调试的问题-Djavax。网debug=ssl,它将提供与ssl相关的所有调试日志

问题是tomcat指的是旧版本的Java1.8。与旧版本的密码套件相比,新版本的Java 1.8具有更多可支持的密码套件。

服务器期望更强大的密码套件(PCI标准从TLS1.0更新到TLS1.2),我很幸运地了解了底层流程

>

客户端-服务器握手发生

服务器向客户端发送Hello

扩展\u主\u秘密扩展服务器\u名称,服务器\u名称:[type=host\u name(0),value=*****]http-443-exec-5,写入:TLSv1。2次握手,长度=206 http-443-exec-5,读取:TLSv1。2次握手,长度=93***服务器你好,TLSv1。2.

使用密码套件验证证书

SSL-对我来说仍然是一个未解之谜,也是一个值得研究的话题。SSL将手伸进大脑:-)

淳于典
2023-03-14

您必须添加以下行以解决握手错误

System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");

你可以在这里和这里找到相关的文章

 类似资料:
  • 我正在用Java为苹果开发一个推送通知服务,为此我使用了JavaPNS 2.2。我使用了本网站提供的教程,在Apple中创建了我的证书,并成功地运行了演示(PHP)。(我还转换了.p12、.pem文件中的证书)。 然而,当我尝试在我的测试类中运行java中的简单消息推送时(如JavaPNS教程中指定的), 我越来越, 在eclipse中调试JavaPNS代码后,我知道错误是由于, 现在我不明白问题

  • 我们有一个Spring Boot应用程序,它被部署到AWS的EC2实例中包含的tomcat上。在本地我有redis设置。在我的申请中。yml我的redis配置如下: 我们用java对其进行了如下配置: 而我在QA中的集群负载平衡器url如下所示: aq***************亚马逊。com:6379实际上隐藏了所有redis集群。 我在本地测试了这个配置。。。。。。还有QA url。 但是不

  • 问题内容: 我需要通过HTTPS协议发出请求。我写了以下代码: 我使用 java.io.EOFException 得到了这个异常stacktrace : 我从 https://google.com 获得了成功的响应,但是以上URL(https://ancine.band.com.br/xml/pgrt1_dta_20150303.xml)中的此错误。 使用PHP,.NET和NodeJS,URL可以

  • 我有一个问题,集成liquibase maven执行与一个mysql 5.7数据库由Azure作为一个服务.错误日志是: 无法执行目标组织。liquibase:liquibase maven插件:3.0.5:项目上的状态(默认cli)-:设置或运行liquibase:com时出错。mysql。jdbc。例外情况。jdbc4。通信异常:通信链路故障发送到服务器的最后一个数据包是575毫秒前的。握手期

  • 在Mark Seemann的博客文章和示例中,我第一次看到了免费单子作为构建纯代码和IO代码之间边界的一种方式。我的基本理解是,一个免费的单子可以让您构建一个纯函数的程序(抽象语法树-AST),然后解释器将其翻译成一系列不纯的过程调用。因此,这个解释器将AST的纯操作转换为一系列的一元IO操作。 我想知道这是否复制了Haskell运行时已经在IO Monad上做的事情。如果我认为IO没有什么特别的

  • gradle提供了两种解决windows路径过长问题的解决方案: 使用Gradle在清单中添加类路径 使用gradle时出现“文件名或扩展名太长错误” 然而,我不清楚如何在多项目设置中处理这一点。所有带有插件的子项目都需要这些更改吗?这也可以在文件中指定吗? 还有更好的解决方法吗? 显然地https://github.com/viswaramamoorthy/gradle-util-plugins