Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JSSE/HTTP/weblogic error

2 views
Skip to first unread message

sgupta

unread,
Jan 18, 2002, 1:13:04 PM1/18/02
to
I am trying to make an https connection from my java class on
weblogic.
I am using Weblogic 5.1 SP9 on NT and will probably use the same
version
later on Solaris 2.6
I am using JSSE 1.0.2 with JDK 1.2.2
The application works fine but every now and then I get an issue that
the
weblogic.net.http.HttpURLConnection begins to be used instead of the
com.sun.net.ssl.HttpsURLConnection class
And then on restarting the weblogic server, everything starts working
fine
again.

Has anybody seen this error and have any solution. Would really
appreciate
your help.

I get the error on the following line:

java.io.PrintWriter Out = new
java.io.PrintWriter(connection.getOutputStream());

java.io.IOException: Nonexportable ciphersuite requested
at weblogic.security.SSL.SSLSocket.clientInit(SSLSocket.java,
Compiled
Code)
at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:217)
at weblogic.security.SSL.SSLSocket.<init>(SSLSocket.java, Compiled
Code)
at weblogic.net.http.HttpsClient.openServer(HttpsClient.java,
Compiled
Code)
at weblogic.net.http.HttpsClient.openServer(HttpsClient.java,
Compiled
Code)
at weblogic.net.http.HttpClient.<init>(HttpClient.java:85)
at weblogic.net.http.HttpsClient.<init>(HttpsClient.java:34)
at weblogic.net.http.HttpClient.New(HttpClient.java, Compiled Code)
at weblogic.net.http.HttpURLConnection.connect(HttpURLConnection.java,
Compiled Code)
at
weblogic.net.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:144)

The Code snippet is:

<Begin>


java.net.URL url = new java.net.URL(eidURL);
java.net.URLConnection connection = url.openConnection();
connection.setRequestProperty("Method", "POST");
connection.setDoOutput(true);
connection.setDoInput(true);
java.io.PrintWriter Out = new
java.io.PrintWriter(connection.getOutputStream());

<End>


On getting the above errors I cast everywhere I could to use
com.sun.net.ssl.HttpsURLConnection
And now it gives me a class cast exception, I presume at the same
statement
as earlier :
java.io.PrintWriter Out = new
java.io.PrintWriter(((com.sun.net.ssl.HttpsURLConnection)connection).getOutputStream());

An excerpt of the code is:

String Request = java.net.URLEncoder.encode(request);

System.setProperty("java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.www.protocol");
java.security.Security.addProvider(new
com.sun.net.ssl.internal.ssl.Provider());


java.net.URL url = new java.net.URL(httpsURL);

// java.net.URLConnection connection = (java.net.URLConnection)
url.openConnection();
com.sun.net.ssl.HttpsURLConnection connection =
(com.sun.net.ssl.HttpsURLConnection) url.openConnection();


/* if (connection instanceof com.sun.net.ssl.HttpsURLConnection)

((com.sun.net.ssl.HttpsURLConnection)connection).setHostnameVerifier(new
NullHostnameVerifier());
*/
((com.sun.net.ssl.HttpsURLConnection)connection).setHostnameVerifier(new
NullHostnameVerifier());
((com.sun.net.ssl.HttpsURLConnection)connection).setRequestProperty("Method",
"POST");
((com.sun.net.ssl.HttpsURLConnection)connection).setDoOutput(true);
((com.sun.net.ssl.HttpsURLConnection)connection).setDoInput(true);

java.io.PrintWriter Out = new
java.io.PrintWriter(((com.sun.net.ssl.HttpsURLConnection)connection).getOutputStream());


Out.print("DATAIN="+Request);
Out.flush();
Out.close();
java.io.BufferedReader in = new java.io.BufferedReader(new
java.io.InputStreamReader(((com.sun.net.ssl.HttpsURLConnection)connection).getInputStream()));


//_________________________________________________________________________________________

/* This inner class is a null version which always returns true when
checking
the server certificate against the hostname of the server
we're
connecting to.
*/
static class NullHostnameVerifier implements
com.sun.net.ssl.HostnameVerifier {
public boolean verify(String urlHostname,String
certHostname) {
return true;
}
}

//_______________________________________________________________________________________

To make JSSE work on weblogic, I made the following changes:

In the Weblogic.policy and java.policy files to have :
permission java.util.PropertyPermission "java.protocol.handler.pkgs",
"write";

Made changes in java.security file to have :
security.provider.2=com.sun.net.ssl.internal.ssl.Provider

And made changes to the Weblogic.properties file to have
weblogic.security.SSLHandler.enable=false

Copied the jnet.jar jcert.jar and jsse.jar into the jre/lib/ext folder
and
put all the jars in the weblogic java classpath.

_____________________________________________________________________________________________

Thanks in advance for your help.

0 new messages