• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Problems connecting to LDAP from Weblogic Server: BAD_CERTIFICATE error!

Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic