My Oracle Support Banner

"JAVA.LANG.ILLEGALSTATEEXCEPTION: CIPHER NOT INITIALIZED" when Integrating CRM On Demand (Doc ID 1068513.1)

Last updated on AUGUST 01, 2018

Applies to:

Oracle SOA Platform - Version 11.1.1.1.0 and later
Information in this document applies to any platform.

Symptoms

When trying to invoke CRM on demand web service from a BPEL Process using java embedding, the following error occurs:

Caused by: java.lang.IllegalStateException: Cipher not initialized
at javax.crypto.Cipher.c(DashoA13*..)
at javax.crypto.Cipher.update(DashoA13*..)
at com.certicom.tls.provider.Cipher.update(Unknown Source)
at com.certicom.tls.record.MessageEncryptor.compressEncryptSend(Unknown Source)
at com.certicom.tls.record.MessageEncryptor.compressEncryptSend(Unknown Source)
at com.certicom.tls.record.MessageFragmentor.write(Unknown Source)
at com.certicom.tls.record.WriteHandler.write(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.fireAlert(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessage(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:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)
at weblogic.net.http.HttpURLConnection.writeRequests(HttpURLConnection.java:158)
at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:363)
at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)
at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:952)
at orabpel.productquerybpelprocess.ExecLetBxExe0.execute(ExecLetBxExe0.java:93)



The issue can be reproduced at will with the following steps:


Create a BPEL process with java embedding the following code:

String sessionString = "FAIL";
String wsLocation =
"https://secure-********.crmondemand.com/Services/Integration";
String headerName;
try {
     // create an HTTPS connection to the OnDemand webservices
     java.net.URL wsURL =
     new java.net.URL(wsLocation + "?command=login");
     java.net.HttpURLConnection wsConnection =
     (java.net.HttpURLConnection)wsURL.openConnection();
     // disable caching
     wsConnection.setUseCaches(false);
     // set some http headers to indicate the username and password we are using to logon
     wsConnection.setRequestProperty("UserName","***************/**********");
wsConnection.setRequestProperty("Password", "***********");
     wsConnection.setRequestMethod("GET");
     // see if we got a successful response
     if (wsConnection.getResponseCode() ==
       java.net.HttpURLConnection.HTTP_OK) {
       // get the session id from the cookie setting
     for (int i = 0; ; i++) {headerName = wsConnection.getHeaderFieldKey(i);
     if (headerName != null && headerName.equals("Set-Cookie"))
     {
        // found the Set-Cookie header (code assumes only one cookie is being set)
        sessionString = wsConnection.getHeaderField(i);
        if (sessionString != null || sessionString.startsWith("JSESSIONID"))
        {
          break;
        }
      }
    }
    String formattedID = sessionString.substring(sessionString.indexOf("=") + 1, sessionString.indexOf(";"));
    setVariableData("SessionID", formattedID);
    //System.out.println("Session ID: " + sessionString);
  }
} catch (Exception e)
  {
    e.printStackTrace();
    setVariableData("SessionID", e.getMessage());
    System.out.println("Logon Exception generated :: " + e);
   throw new RuntimeException(e);
}

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References

This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.
My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.