• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems connecting to LDAP from Weblogic Server: BAD_CERTIFICATE error!  RSS feed

Stephen Ma
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to connect to LDAP using a simple webservice call from an application deployed on a weblogic server. The error I am receiving is:

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)

The error happens when I call OutputStream out = httpConn.getOutputStream(); on the following code:

private Document sendSoapMessage(String request, String action, String task)
throws Exception {

//transfer request into byte array
byte[] b = request.getBytes();

// Create the connection where we're going to send the file.
URL url = new URL(LDAP_URL + task);

//create http url connection
// URLConnection connection = url.openConnection();
// HttpURLConnection httpConn = (HttpURLConnection) connection;
SSLAdapter adapter = SSLAdapterFactory.getDefaultFactory().getSSLAdapter();
HttpURLConnection httpConn = (HttpURLConnection) adapter.openConnection(url);

// Set the appropriate HTTP parameters.
httpConn.setRequestProperty("Content-Length", String.valueOf(b.length));
httpConn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
httpConn.setRequestProperty("SOAPAction", action);
httpConn.setRequestProperty("HOST", "");

// Everything's set up; send the XML that was read in to b.
OutputStream out = httpConn.getOutputStream();
out.write( b );

InputStream is = null;
try {
is = httpConn.getInputStream();
} catch (IOException e) {
is = httpConn.getErrorStream();

// Read the response and write it to standard out.
// InputStreamReader isr = new InputStreamReader(is, "UTF-8");
// BufferedReader in = new BufferedReader(isr);
// String inputLine;
// while ((inputLine = in.readLine()) != null)
// System.out.println(inputLine);
// in.close();

// Read the response
DOMParser parser = new DOMParser();

InputSource source = new InputSource(is);


//return the information
return parser.getDocument();

The funny thing is, this same piece of code works if I put it in a simple java harness, but does not work when I deploy it to the weblogic server. I'm a noob when it comes to SSL connections and whatnot, and this problem is killing me! I would appreciate ANY help!

Thank you!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!