无法在AXsphere 8.5上使用TLSv1.2将我的AXIS2客户端连接到远程服务器

时间:2017-01-21 17:21:36

标签: java websphere axis2

由于我无法找到解决previous problem的方法,我决定躲开它并生成一个AXIS2项目来解决它。(如果有人知道如何解决我以前的问题,请告诉我。我&# 39;如果可以解决问题,请切换回它。)

让我们回到这个主题。

我的服务器正在使用带有Java 1.8的Websphere 8.5(1.7和1.6仍然存在,但我认为它们因为我将默认值设置为1.8而不会引起麻烦),而且我在群集上运行具有2个WAS节点的模式。

我从管理器控制台部署了我的AXIS2客户端(带有1.7.4个罐子)并将此应用程序设置为父加载最后以防止与WAS自己的AXIS冲突,它运行良好除了一个问题:它无法连接到使用TLSv1.2的远程WebLogic Server。

我已将WebLogic的证书添加到clusterDefaultTrustKeyStore中,而我的WAS正在使用Java 1.8运行。但即使我将System.setProperty("https.protocols", "TLSv1.2");添加到构造函数中,我仍然无法使用https://连接到该服务器。这对我来说真的很麻烦。

这是我得到的例外:

class org.apache.axis2.AxisFault:javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

堆栈跟踪:

[
  {
    "declaringClass": "org.apache.axis2.AxisFault",
    "methodName": "makeFault",
    "fileName": "AxisFault.java",
    "lineNumber": 430
  },
  {
    "declaringClass": "org.apache.axis2.transport.http.SOAPMessageFormatter",
    "methodName": "writeTo",
    "fileName": "SOAPMessageFormatter.java",
    "lineNumber": 78
  },
  {
    "declaringClass": "org.apache.axis2.transport.http.AxisRequestEntity",
    "methodName": "writeRequest",
    "fileName": "AxisRequestEntity.java",
    "lineNumber": 85
  },
  {
    "declaringClass": "org.apache.commons.httpclient.methods.EntityEnclosingMethod",
    "methodName": "writeRequestBody",
    "fileName": "EntityEnclosingMethod.java",
    "lineNumber": 499
  },
  {
    "declaringClass": "org.apache.commons.httpclient.HttpMethodBase",
    "methodName": "writeRequest",
    "fileName": "HttpMethodBase.java",
    "lineNumber": 2114
  },
  {
    "declaringClass": "org.apache.commons.httpclient.HttpMethodBase",
    "methodName": "execute",
    "fileName": "HttpMethodBase.java",
    "lineNumber": 1096
  },
  {
    "declaringClass": "org.apache.commons.httpclient.HttpMethodDirector",
    "methodName": "executeWithRetry",
    "fileName": "HttpMethodDirector.java",
    "lineNumber": 398
  },
  {
    "declaringClass": "org.apache.commons.httpclient.HttpMethodDirector",
    "methodName": "executeMethod",
    "fileName": "HttpMethodDirector.java",
    "lineNumber": 171
  },
  {
    "declaringClass": "org.apache.commons.httpclient.HttpClient",
    "methodName": "executeMethod",
    "fileName": "HttpClient.java",
    "lineNumber": 397
  },
  {
    "declaringClass": "org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl",
    "methodName": "executeMethod",
    "fileName": "HTTPSenderImpl.java",
    "lineNumber": 872
  },
  {
    "declaringClass": "org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl",
    "methodName": "sendViaPost",
    "fileName": "HTTPSenderImpl.java",
    "lineNumber": 212
  },
  {
    "declaringClass": "org.apache.axis2.transport.http.HTTPSender",
    "methodName": "send",
    "fileName": "HTTPSender.java",
    "lineNumber": 121
  },
  {
    "declaringClass": "org.apache.axis2.transport.http.CommonsHTTPTransportSender",
    "methodName": "writeMessageWithCommons",
    "fileName": "CommonsHTTPTransportSender.java",
    "lineNumber": 403
  },
  {
    "declaringClass": "org.apache.axis2.transport.http.CommonsHTTPTransportSender",
    "methodName": "invoke",
    "fileName": "CommonsHTTPTransportSender.java",
    "lineNumber": 234
  },
  {
    "declaringClass": "org.apache.axis2.engine.AxisEngine",
    "methodName": "send",
    "fileName": "AxisEngine.java",
    "lineNumber": 431
  },
  {
    "declaringClass": "org.apache.axis2.description.OutInAxisOperationClient",
    "methodName": "send",
    "fileName": "OutInAxisOperation.java",
    "lineNumber": 399
  },
  {
    "declaringClass": "org.apache.axis2.description.OutInAxisOperationClient",
    "methodName": "executeImpl",
    "fileName": "OutInAxisOperation.java",
    "lineNumber": 225
  },
  {
    "declaringClass": "org.apache.axis2.client.OperationClient",
    "methodName": "execute",
    "fileName": "OperationClient.java",
    "lineNumber": 150
  },
  {
    "declaringClass": "org.openuri.www.TestServiceStub",
    "methodName": "getRSAPublicKey",
    "fileName": "TestServiceStub.java",
    "lineNumber": 841
  }
  ...
]

WAS的系统日志:

Caused by: javax.xml.stream.XMLStreamException: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    at com.ibm.xml.xlxp2.api.stax.msg.StAXMessageProvider.throwXMLStreamException(StAXMessageProvider.java:67)
    at com.ibm.xml.xlxp2.api.stax.XMLStreamWriterImpl.flush(XMLStreamWriterImpl.java:766)
    at com.ibm.xml.xlxp2.api.stax.XMLOutputFactoryImpl$XMLStreamWriterProxy.flush(XMLOutputFactoryImpl.java:155)
    at org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper.flush(XMLStreamWriterWrapper.java:50)
    at org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:231)
    at org.apache.axiom.om.impl.MTOMXMLStreamWriter.close(MTOMXMLStreamWriter.java:223)
    at org.apache.axiom.om.impl.common.AxiomContainerSupport.ajc$interMethod$org_apache_axiom_om_impl_common_AxiomContainerSupport$org_apache_axiom_om_impl_intf_AxiomContainer$serializeAndConsume(AxiomContainerSupport.aj:324)
    at org.apache.axiom.om.impl.llom.OMElementImpl.serializeAndConsume(OMElementImpl.java:1)
    at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
    ... 47 more
Caused by: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    at com.ibm.jsse2.as.k(as.java:174)
    at com.ibm.jsse2.as.l(as.java:677)
    at com.ibm.jsse2.h.write(h.java:33)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:93)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:151)
    at org.apache.commons.httpclient.ChunkedOutputStream.flush(ChunkedOutputStream.java:191)
    at com.ibm.xml.xlxp2.api.stax.serializer.StAXWriter.flush(StAXWriter.java:65)
    at com.ibm.xml.xlxp2.api.stax.XMLStreamWriterImpl.flush(XMLStreamWriterImpl.java:763)
    ... 54 more
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    at com.ibm.jsse2.j.a(j.java:31)
    at com.ibm.jsse2.j.a(j.java:43)
    at com.ibm.jsse2.as.b(as.java:816)
    at com.ibm.jsse2.as.a(as.java:752)
    at com.ibm.jsse2.as.i(as.java:130)
    at com.ibm.jsse2.as.a(as.java:497)
    at com.ibm.jsse2.h.write(h.java:23)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:93)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:151)
    at org.apache.commons.httpclient.ChunkedOutputStream.flush(ChunkedOutputStream.java:191)
    at com.ibm.xml.xlxp2.api.stax.serializer.StAXWriter.flush(StAXWriter.java:65)
    at com.ibm.xml.xlxp2.api.stax.XMLStreamWriterImpl.flush(XMLStreamWriterImpl.java:763)
    at com.ibm.xml.xlxp2.api.stax.XMLOutputFactoryImpl$XMLStreamWriterProxy.flush(XMLOutputFactoryImpl.java:155)
    at org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper.flush(XMLStreamWriterWrapper.java:50)
    at org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:231)
    at org.apache.axis2.databinding.ADBDataSource.serialize(ADBDataSource.java:50)
    at org.apache.axiom.om.impl.common.serializer.push.stax.StAXSerializer.serializePushOMDataSource(StAXSerializer.java:53)
    at org.apache.axiom.om.impl.common.serializer.push.Serializer.serialize(Serializer.java:293)
    at org.apache.axiom.om.impl.common.AxiomSourcedElementSupport.ajc$interMethod$org_apache_axiom_om_impl_common_AxiomSourcedElementSupport$org_apache_axiom_om_impl_intf_AxiomSourcedElement$internalSerialize(AxiomSourcedElementSupport.aj:434)
... 69 more

根据系统日志,最有可能是原因。但我不知道为什么以及如何解决它,并且无法在stackoverflow中找到任何直接相关的主题。有人可以帮我吗?

2 个答案:

答案 0 :(得分:0)

您可以通过将其添加到Websphere的自定义JVM属性来尝试jsse.enableSNIExtension=false 如果目标服务器的证书由CA签名,您还应该将这些CA证书添加到KeyStore。

答案 1 :(得分:0)

......好吧,我觉得自己被骗了。

他们声称自己只接受TLSv1.2并且我买了它,但SSL调试日志告诉了另一个TRUTH。

000000fa SystemOut     O WebContainer : 1, READ: TLSv1 Alert, length = 2
00000014 SystemOut     O Finalizer thread, called close()
00000014 SystemOut     O Finalizer thread, called closeInternal(true)
00000014 SystemOut     O Finalizer thread, called closeSocket(true)
000000fa SystemOut     O WebContainer : 1, RECV TLSv1.2 ALERT:  fatal, handshake_failure

在深入查看日志之后,我确实使用了TLSv1.2,但他们似乎不支持它(或者他们没有启用它),这导致握手失败。