2012-12-07 49 views
3

的我的Java代碼執行的過程中我得到這個錯誤消息javax.net.ssl.SSLException的隨機發生:無法識別的SSL消息,純文本連接?

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分鐘後,我的program.Sometimes,有時後8分鐘,sumtime後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"); 

回答

1

我想這是因爲你使用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 {}塊中,這樣它只會被加載一次,不需要重複設置。

1

除非您始終使用相同的URL來運行此操作,否則您正在執行與異常情況相同的操作:使用SSL連接到純文本端口。偶爾。

0

設置的環境變量

_JAVA_OPTIONS = -Djava.net.preferIPv4Stack=true 

這解決了我的issue.If你是公司的專用網絡上,給它一個嘗試。

相關問題