• 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 ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Problems connecting to LDAP from Weblogic Server: BAD_CERTIFICATE error!

 
Greenhorn
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.setRequestMethod("POST");
httpConn.setDoOutput(true);
httpConn.setDoInput(true);
httpConn.setRequestProperty("HOST", "10.84.10.170");

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

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

//TODO/////////////////////////////////////////////////////////
// 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);
parser.parse(source);

//cleanup
is.close();
httpConn.disconnect();

//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!
Steve
 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic