Unable to access HTTPS from Weblogic

I have a problem with Weblogic accessing an HTTPS server, I can access other HTTPS URLs like google or microsoft. Code trying to connect to url:

URL url = new URL("https://myserver.com"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); // fails here responseCode = connection.getResponseCode(); 

I get the following stack trace:

 java.io.IOException: Connection closed, EOF detected at weblogic.socket.JSSEFilterImpl.handleUnwrapResults(JSSEFilterImpl.java:539) at weblogic.socket.JSSEFilterImpl.unwrapAndHandleResults(JSSEFilterImpl.java:456) at weblogic.socket.JSSEFilterImpl.doHandshake(JSSEFilterImpl.java:80) at weblogic.socket.JSSEFilterImpl.doHandshake(JSSEFilterImpl.java:64) at weblogic.socket.JSSEFilterImpl.doHandshake(JSSEFilterImpl.java:59) at weblogic.socket.JSSEFilterImpl.write(JSSEFilterImpl.java:390) at weblogic.socket.JSSESocket$JSSEOutputStream.write(JSSESocket.java:78) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) at java.io.FilterOutputStream.flush(FilterOutputStream.java:140) at weblogic.net.http.HttpURLConnection.writeRequests(HttpURLConnection.java:186) at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:400) at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37) at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:1005) 

In the Weblogic console, I have the following option set: true: Environment> Servers> [my server]> SSL> Advanced> Use JSSE SSL

If I disable this property, I get the following stack trace:

 javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received. at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireException(Unknown Source) at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknown Source) at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown Source) at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown Source) at com.certicom.tls.record.MessageInterpreter.interpretContent(Unknown Source) at com.certicom.tls.record.MessageInterpreter.decryptMessage(Unknown Source) at com.certicom.tls.record.ReadHandler.processRecord(Unknown Source) at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source) at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown Source) at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown Source) at com.certicom.tls.record.WriteHandler.write(Unknown Source) at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) at java.io.FilterOutputStream.flush(FilterOutputStream.java:140) at weblogic.net.http.HttpURLConnection.writeRequests(HttpURLConnection.java:186) at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:400) at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37) at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:1005) 

The server I'm trying to access has a verified certificate, and browsers do not complain about it.

thanks

+5
source share
2 answers

In the end, this worked by setting them in the Weblogic arguments:

 -DUseSunHttpHandler=true -Dssl.SocketFactory.provider=sun.security.ssl.SSLSocketFactoryImpl -Dssl.ServerSocketFactory.provider=sun.security.ssl.SSLSocketFactoryImpl 

According to these posts: fooobar.com/questions/538592 / ... and https://community.oracle.com/thread/2523332 p>

+21
source

For me, using -DUseSunHttpHandler=true works, but I cannot have this parameter, because then I have problems restarting the Managed Server when redeploying.

It helps me:

 url = new URL(null,"https://yoururl.com",new sun.net.www.protocol.https.Handler()); 
+2
source

Source: https://habr.com/ru/post/1211016/


All Articles