在执行我的java代码期间,我收到此错误消息
Exception in thread "main" AxisFault faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode: faultString: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
faultActor: faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at
com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(InputRecord.java:523) at
com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:355) at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:830) at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1170) at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1197) at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1181) 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:2765) at
org.apache.axis.client.Call.invoke(Call.java:2748) at
org.apache.axis.client.Call.invoke(Call.java:2424) at
org.apache.axis.client.Call.invoke(Call.java:2347) at
org.apache.axis.client.Call.invoke(Call.java:1804) at
crmondemand.ws.ecbs.customobject5.CustomObject5_BindingStub.customObject5Update(CustomObject5_BindingStub.java:301) at
crm.sapGUID.urlupdate(sapGUID.java:170) at
crm.sapGUID.readExcelFile(sapGUID.java:102) at
crm.sapGUID.main(sapGUID.java:218)
每次重新运行程序时,此错误的发生都是随机的。有时在 10 分钟后,有时在 8 分钟后,1 分钟后的总和时间甚至在 15 分钟后
。我在代理后面,并且在我的 JAVA 中硬编码了与我的 Internt 资源管理器中相同的代理设置,作为
System.setProperty("https.proxyHost", "172.*.*.*");
System.setProperty("https.proxyPort", "8003");
System.setProperty("javax.net.ssl.trustStore", "/Oracle/Middleware/wlserver_10.3/server/lib/cacerts");
这是因为您正在使用System.setProperty()
...如果同一 JVM 中的其他内容正在调用相同的 System.setProperty(),它将覆盖您的设置。 您在这里最好的选择是使用:
InetSocketAddress proxyInet = new InetSocketAddress("172...*",8003);
Proxy proxy = new Proxy(Proxy.Type.HTTP, proxyInet);
javax.net.ssl.trustStore
可能没问题,因为它是通过命令行的 -D 选项传入的并且很少更改,因此,我认为您无需在代码中设置它。 至少如果你需要它,把它放在一个static {}
块中,这样它只会加载一个,不需要重复设置。
除非您始终使用相同的URL运行它,否则您正在执行异常中所说的操作:使用SSL连接到明文端口。偶尔。
设置环境变量
_JAVA_OPTIONS = -Djava.net.preferIPv4Stack=true
这解决了我的问题。如果您在公司的专用网络上,请尝试一下。