javax.net.ssl.SSLException:无法识别的SSL消息,明文连接?

lak*_*i K 11 java ssl https axis asmx

如何在使用轴jar从java调用SSL("https:")协议上托管的.net Web服务(asmx)时解决上述异常.

执行代码时收到以下错误消息:

faultDetail: 
 {http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
 at com.ibm.jsse2.a.c(a.java:228)
 at com.ibm.jsse2.a.a(a.java:63)
 at com.ibm.jsse2.jc.a(jc.java:465)
 at com.ibm.jsse2.jc.g(jc.java:458)
 at com.ibm.jsse2.jc.a(jc.java:67)
 at com.ibm.jsse2.jc.startHandshake(jc.java:342)
 at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:186)
 at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
 at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
 at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
 at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
 at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
 at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
 at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
 at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
 at org.apache.axis.client.Call.invoke(Call.java:2767)
 at org.apache.axis.client.Call.invoke(Call.java:2443)
 at org.apache.axis.client.Call.invoke(Call.java:2366)
 at org.apache.axis.client.Call.invoke(Call.java:1812)
 at examples.Example_client.main(Example_client.java:79)

 {http://xml.apache.org/axis/}hostname:D-113020008
Run Code Online (Sandbox Code Playgroud)

小智 6

您可能正在使用代理来获取ssl内容,但您的代理设置是错误的.您应该考虑使用http作为代理方案,然后使用https作为实际内容的方案.这解决了我的问题.


use*_*421 5

正如错误消息所说,概率是对等方正在说纯文本,而不是SSL.

  • 实际上我遇到了这个问题,它与代理设置相关联.在我的情况下,我需要绕过代理设置,只需使用直接连接到服务.我能够通过在`http.nonProxyHosts` HTTP设置中设置目标系统的主机名来实现这一点,该设置与为非HTTPS主机设置的属性相同.在Axis中它可以像这样完成:`AxisProperties.setProperty("http.nonProxyHosts","example.com");`(这是关于[Java网络和代理]的一篇有用的文章(http://docs.oracle. COM/JavaSE的/ 6 /文档/技术说明/指南/净/ proxies.html)). (4认同)