0
我有一箇舊的軟件進行改進。這是Java 1.4和WebLogic 8.1服務器中的一個系統。我有一個與HTTPS網址連接的問題。該系統在企業環境中工作良好,所以我認爲問題出在我的環境中。問題在weblogic 8.1 soaphttpsurlconnection
import weblogic.net.http.SOAPHttpsURLConnection;
import weblogic.security.SSL.SSLSocketFactory;
...
URL ruta = new URL(url);
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SOAPHttpsURLConnection conn = (SOAPHttpsURLConnection)ruta.openConnection();
conn.setSSLSocketFactory(sslsocketfactory);
conn.setDoInput(true);
conn.setDoOutput(true);
cat.debug("Conn OK");
InputStream is = conn.getInputStream();
DocumentBuilderFactory dml = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dml.newDocumentBuilder();
Document doc = db.parse(is);
Element rootElement = doc.getDocumentElement();
在此行是當異常或錯誤發生。
InputStream is = conn.getInputStream();
我不知道是什麼問題,但應用程序日誌中,最後一個是我擁有的是:
cat.debug("Conn OK");
我試圖與周圍一個try/catch句子這一行和這個:Link
InputStream is = null;
try {
System.out.println("getInputStream():before--------------");
is = conn.getInputStream();
System.out.println("getInputStream():after---------------");
} catch (Exception e) {
System.out.println("ERROR getInputStream():**************");
e.printStackTrace();
cat.debug("Exception e.getCause: "+e.getCause());
cat.debug("Exception e.getMesaje: "+e.getMessage());
}
我不知道是什麼問題。如果是連接或getInputStream。我的問題的先行者是connexion有一個代理,設置:
System.setProperty("https.proxyHost", "proxy");
System.setProperty("https.proxyPort", "8080");
有了這個conf。無一例外不會出現INT服務器一樣,這是所有(最後):
getInputStream():before--------------
<18-03-2014 06:29:23 PM GMT> <Notice> <Security> <BEA-090169> <Loading trusted c
ertificates from the jks keystore file C:\Oracle\Middleware\weblogic81\server\li
b\DemoTrust.jks.>
<18-03-2014 06:29:23 PM GMT> <Notice> <Security> <BEA-090169> <Loading trusted c
ertificates from the jks keystore file C:\Oracle\MIDDLE~1\JDK142~1\jre\lib\secur
ity\cacerts.>
當我不能把代理的設置,在服務器中的例外是超時。
getInputStream():before--------------
ERROR getInputStream():**************
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
和URL連接是一個POST返回一個XML結構。我盡力做到一切皆有可能,但我沒有成功。如果有人有任何想法,請讓我知道。如果你需要更多的前線,請問我。 (對不起英語不好)。問候!