Question

I have a old software for improvements. This is a system in Java 1.4 and WebLogic 8.1 server. I’ve an issue with a connection to HTTPS URL. The system work fine in the ambient of enterprise , so I think the problem is in my environment.

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();

In this line is when the exception or error occur.

InputStream is = conn.getInputStream();

I don't know what is the problem, but in the log of App, the last what I have is:

 cat.debug("Conn OK");

I tried to surround this line with a try/catch sentence and this: 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());
                }

I don't know what is the problem. If it's the connection or the getInputStream. The antecedent of my problem is the connexion have a proxy, setting:

System.setProperty("https.proxyHost", "proxy");
System.setProperty("https.proxyPort", "8080");

With this conf. none exception not appear int the server, like this is all (the last):

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.>

When I not put the setting of proxy the, exception in the server is Time Out.

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)

and the URL conection is a POST with return a XML struct. I try to do everything is possible, but not I've successful. If anybody have any idea please let me know. If you need more antecendts please ask me. (sorry for the bad english). Regards!

Was it helpful?

Solution

The problem and the solution is: The WebLogic 8.1 SP4 (don't know the patch) have a Bug with the SSL conecction. The solution for me, is update the service pack to a most recently version, like SP6. Regards.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top