- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
当我尝试通过 Internet 对 Web 服务进行 HTTPS 发布时,我收到 javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake 异常。但相同的代码适用于其他互联网托管的 Web 服务。我尝试了很多东西,没有任何帮助。我在这里发布了我的示例代码。谁能帮我解决这个问题?
public static void main(String[] args) throws Exception {
String xmlServerURL = "https://example.com/soap/WsRouter";
URL urlXMLServer = new URL(xmlServerURL);
// URLConnection supports HTTPS protocol only with JDK 1.4+
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(
"xxxx.example.com", 8083));
HttpURLConnection httpsURLConnection = (HttpURLConnection) urlXMLServer
.openConnection(proxy);
httpsURLConnection.setRequestProperty("Content-Type","text/xml; charset=utf-8");
//httpsURLConnection.setDoInput(true);
httpsURLConnection.setDoOutput(true);
httpsURLConnection.setConnectTimeout(300000);
//httpsURLConnection.setIgnoreProxy(false);
httpsURLConnection.setRequestMethod("POST");
//httpsURLConnection.setHostnameVerifier(DO_NOT_VERIFY);
// send request
PrintWriter out = new PrintWriter(
httpsURLConnection.getOutputStream());
StringBuffer requestXML = new StringBuffer();
requestXML.append(getProcessWorkOrderSOAPXML());
// get list of user
out.println(requestXML.toString());
out.close();
out.flush();
System.out.println("XML Request POSTed to " + xmlServerURL + "\n");
System.out.println(requestXML.toString() + "\n");
//Thread.sleep(60000);
// read response
BufferedReader in = new BufferedReader(new InputStreamReader(
httpsURLConnection.getInputStream()));
String line;
String respXML = "";
while ((line = in.readLine()) != null) {
respXML += line;
}
in.close();
// output response
respXML = URLDecoder.decode(respXML, "UTF-8");
System.out.println("\nXML Response\n");
System.out.println(respXML);
}
完整的堆栈跟踪:
Exception in thread "main" javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:946)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1091)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
at com.labcorp.efone.vendor.TestATTConnectivity.main(TestATTConnectivity.java:43)
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:927)
... 8 more
其实这里有两种情况。当我作为一个独立的 Java 程序工作时,我遇到了上述异常。但是当我尝试在 weblogic 应用程序服务器中执行时,我得到了以下异常:任何线索可能是什么原因?
java.io.IOException: Connection closed, EOF detected
at weblogic.socket.JSSEFilterImpl.handleUnwrapResults(JSSEFilterImpl.java:637)
at weblogic.socket.JSSEFilterImpl.unwrapAndHandleResults(JSSEFilterImpl.java:515)
at weblogic.socket.JSSEFilterImpl.doHandshake(JSSEFilterImpl.java:96)
at weblogic.socket.JSSEFilterImpl.doHandshake(JSSEFilterImpl.java:75)
at weblogic.socket.JSSEFilterImpl.write(JSSEFilterImpl.java:448)
at weblogic.socket.JSSESocket$JSSEOutputStream.write(JSSESocket.java:93)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:140)
at weblogic.net.http.HttpURLConnection.writeRequests(HttpURLConnection.java:192)
at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:433)
at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)
at com.labcorp.efone.service.impl.WorkOrderServiceImpl.processATTWorkOrder(ATTWorkOrderServiceImpl.java:86)
at com.labcorp.efone.bds.WorkOrderBusinessDelegateImpl.processATTWorkOrder(WorkOrderBusinessDelegateImpl.java:59)
at com.labcorp.efone.actions.ATTWorkOrderAction.efonePerformForward(ATTWorkOrderAction.java:41)
at com.labcorp.efone.actions.EfoneAction.efonePerformActionForward(EfoneAction.java:149)
at com.labcorp.efone.actions.EfoneAction.execute(EfoneAction.java:225)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:751)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at com.labcorp.efone.security.EfoneAuthenticationFilter.doFilter(EfoneAuthenticationFilter.java:115)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3367)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3333)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2220)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2146)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
Exception: java.io.IOException: Connection closed, EOF detected
最佳答案
Java 7 默认为 TLS 1.0,如果不接受该协议(protocol),可能会导致此错误。我在 Tomcat 应用程序和不再接受 TLS 1.0 连接的服务器上遇到了这个问题。我加了
-Dhttps.protocols=TLSv1.1,TLSv1.2
到 Java 选项并修复它。 (Tomcat 运行的是 Java 7。)
关于javax.net.ssl.SSLHandshakeException : Remote host closed connection during handshake during web service communicaiton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21245796/
我正在从不同来源获取新闻提要并添加到数据库,但我遇到异常 Error: Cannot enqueue Handshake after already enqueuing a Handshake. at
嘿,大家好,我只是想制作一个简单的表单,将数据发送到 mySQL 数据库。我的问题是提交后我无法再提交另一份。它只允许我提交表单一次,然后在第二次提交后,我收到此错误“错误:在已经排队握手后无法排队握
我正在尝试将 VisualVM 连接到远程 JMX。 IntelliJ 可以轻松连接,但 VisualVM 失败并在日志输出中显示以下内容: Listening for transport dt_so
我每 5 秒查询一个表并向用户显示。我使用的是mysql 8。应用程序是nodejs。 var con = mysql.createConnection({ host: "localhost",
我正在尝试创建两个函数,一个从 SQL 数据库检索对象,另一个将对象保存到同一个 SQL 数据库。我使用 node.js 和 mysql 来执行此操作。我有两个函数,fetchEmployee 和 E
我正在尝试通过运行命令 ./mvnw compile quarkus:dev 来调试基本的 Quarkus 应用程序在 IntelliJ 上(如 Quarkus 文档中所述)并且它似乎运行正常(给我以
我正在开发一个由 IIS 10 托管的 .Net Core (3.1) Web 应用程序。当我尝试在本地主机上使用 SignalR 时,我能够完全正常连接并从后端接收消息,但是在我将其发布到 IIS
我最近从 AWS ELB 切换到 HAProxy。我正在负载均衡器 (HAProxy 1.5dev19) 上终止 SSL。 自切换以来,我不断在 HAProxy 日志中收到一些 SSL 连接错误(占请
我编写了一个系统,可以自动在 Microsoft Azure 上部署 VM,在上面安装 Sql Server,然后针对新安装的服务器执行 .sql 脚本以初始化环境。周五,这一切都按预期进行。今天,我
我尝试使用 Hyperledger 版本 2.0.0 将我的 Golang 后端连接到正在运行的 Hyperledger 网络... 我在运行“docker-compose up”时看到这个 Serv
我在安装我们的内部产品时遇到 SSL 配置问题。安装在jboss-eap-6.1.上,使用java-1.7.0-openjdk-1.7.0.85.x86_64 日志说: 16:28:11,685 DE
我做到了 import requests url = "https://randomuser.me/api/" data = requests.get(url).json() print data 我
我正在运行为 HTTP/2 客户端提供的代码 Jetty https://github.com/eclipse/jetty.project/blob/master/jetty-http2/http2-
我需要在使用命名管道与其他进程通信的小型 Linux 程序中实现握手类型协议(protocol)。我已经在使用命名管道时搜索了握手类型协议(protocol)的一般实现模式,但我无法打开任何东西...
我安装了 Docker 版本“Docker 版本 19.03.8,构建 afacb8b”,当我尝试使用 docker pull 命令时,如“docker pull mcr.microsoft.com/
我正在使用 python asynchat 来实现网络协议(protocol)。在连接时,我需要发送命令,服务器通过 session 进行应答。 我的主要问题是我需要等待直到收到 session 响应
握手完成后,我在握手时调用 getPeerCertificates() (socket.getHandshakeSession()) 我正在使用 setNeedClientAuth(true)在服务器
我在 logstash-forward 和 logstash 之间有问题,我已经正确安装了 SSL 证书,但是我有这个错误: Failed to tls handshake with 111.111.
本文整理了Java中us.ihmc.robotDataLogger.handshake.YoVariableHandshakeParser类的一些代码示例,展示了YoVariableHandshake
我是 R 语言的新手 并且正在使用 RConnection 在 java 中尝试一个简单的程序,但它给出了这个异常 org.rosuda.REngine.Rserve.RserveException:
我是一名优秀的程序员,十分优秀!