tomcat - HttpsURLConnectionImpl.getInputStream:SSL 错误连接重置
问题描述
我的 java 代码尝试从它的服务器获取文档。作为文档的两个代码都位于同一域中的 Tomcat 服务器上。https://domain/webapp/static/document.
当我运行这段代码时:
try (InputStream stream = conn.getInputStream();
XWPFDocument doc = new XWPFDocument(OPCPackage.open(stream));) {
} catch (InvalidFormatException e) {
e.printStackTrace();
}
我收到此异常:
Caused by: javax.net.ssl.SSLException: Connection reset
at sun.security.ssl.Alert.createSSLException(Alert.java:127)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:324)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:267)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:262)
at sun.security.ssl.SSLTransport.decode(SSLTransport.java:135)
at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1143)
at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1054)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:394)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
at cob.securitymanager.CustomerBean.createCustomerReadyDocFromTemplate(CustomerBean.java:1894)
at cob.securitymanager.CustomerBean.downloadFile(CustomerBean.java:1850)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.el.parser.AstValue.invoke(AstValue.java:279)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:273)
at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
... 48 more
Suppressed: java.net.SocketException: Broken pipe (Write failed)
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:81)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:355)
我真的不是 SSL 专家。
解决方案
推荐阅读
- visual-studio-code - 如何捕获为 VSCode 扩展 api 添加/删除/修改的行
- kubernetes - Kubernetes CoreDns livenessProbe url 缺少 ip/hots
- c - 使用指针更改整数变量的字节
- python - 如何在 Python 中有效地定义许多具有关闭名称和关闭内容的函数
- django - Django:模板上重新组合的项目的总和
- flutter - 颤振通知图标在Android中没有改变
- electron - 通过requirejs导入电子
- google-apps-script - 有没有办法在 Google 表格中创建脚本来打印 2 份活动工作表?
- python - Python 如何从打印结果中删除前导回车?
- javascript - JavaScript 前导零数字填充