Thursday, June 26, 2008

Malformed URL error when deploying BPEL demos

In this case, the error was thrown when deploying the workflow form for the AsyncLoanService demo.

I got rid of this error by amending the file in the \bpel\utilities directory.

Check the values for
hostname =
j2ee.hostname = ncommisk-de

j2ee.hostname =

Thursday, June 12, 2008

Various other ESB Design Time errors

ORA-12516 when installing ESB
Please check the following parameter values –
processes - Recommended is 150
sessions - Recommended is 100

Login to SQLPLUS as system –
show parameters processes
alter system set processes = 150 scope=spfile;
show parameters sessions
alter system set sessions = 100 scope=spfile;

jdbc/esb not found

ensure you have the following in the oc4j_esbdt data-sources.xml

esb console doesn't start automatically

check the server.xml at

to ensure that the app has been defined with start="true"

Tuesday, May 6, 2008

Deleting BPEL instances and related human workflow data from the database

The scenario - I want to delete BPEL process instances along with any related Human Workflow data from the dehydration store.

I took the first part from the collaxa package in the ORABPEL schema, then added the rest for human workflow cleanup.

procedure delete_ci_wf( p_cikey in integer )
cursor c_wftask (v_cikey in cube_scope.CIKEY%TYPE)is
select taskid
from wftask
where instanceid = v_cikey;

v_taskid wftask.TASKID%TYPE;

-- Delete the cube instance first
delete from cube_instance where cikey = p_cikey;

-- Then cascade the delete to other tables with references
delete from cube_scope where cikey = p_cikey;
delete from work_item where cikey = p_cikey;
delete from wi_exception where cikey = p_cikey;
delete from scope_activation where cikey = p_cikey;
delete from dlv_subscription where cikey = p_cikey;
delete from audit_trail where cikey = p_cikey;
delete from audit_details where cikey = p_cikey;
delete from sync_trail where cikey = p_cikey;
delete from sync_store where cikey = p_cikey;
delete from test_details where cikey = p_cikey;
delete from document_ci_ref where cikey = p_cikey;

-- Then cascade the delete to the human workflow tables
-- with references to this instance
-- cube_instance cikey = wftask.instanceid

OPEN c_wftask (p_cikey);
FETCH c_wftask into v_taskid;
delete from wftaskhistory where taskid = v_taskid;
delete from wfassignee where taskid = v_taskid;
delete from wfattachment where taskid = v_taskid;
delete from wfcomments where taskid = v_taskid;
delete from wfmessageattribute where taskid = v_taskid;
delete from wfnotification where taskid = v_taskid;
delete from wfnotificationmessages where taskid = v_taskid;
delete from wfroutingslip where taskid = v_taskid;
delete from wftasktimer where taskid = v_taskid;

delete from wftask where instanceid = p_cikey;
end delete_ci_wf;

Naturally for a comprehensive purge I will have to delete the stale instances from invoke_message, dlv_message , xml_document etc.

Friday, April 25, 2008

Checking input XML for optional elements

The scenario - Check whether the optional Title element is present in the input XML payload to the BPEL process. If it isn't present, then add it with the default value "DefaultValue".

The XSD -

The input XML -

I created a simple synchronous BPEL process with input and output variable set to outputCustomerData. I added a transform activity.

The following will check whether the element is present and set the default value, if necessary.

Monday, March 3, 2008

AD4J - App Diagnostics for Java

I'm currently looking at the area of SOA High Availability, Config/Tuning.
AD4J slots very nicely in here for JVM and DB diagnostics

Download from

Install doc guide at

Usage scenarios doc at

Friday, February 22, 2008

Oracle ESB -Designtime cache has not been initialized

I got this error just after installing the ESB DesignTime(Repository) component on SOA Suite when I called up http://localhost:7777/esb

I looked in the logfiles for the oc4j instance hosting esbdt

In my case at

The error message was as follows -

java.lang.NoClassDefFoundError: org/apache/log4j/Category))

The workaround is as follows -

Add the following line to the orion-application.xml file for esbdt


Tuesday, February 12, 2008


Acegi Security is a powerful, flexible security solution for enterprise software, with a particular emphasis on applications that use Spring. Using Acegi Security provides your applications with comprehensive authentication, authorization, instance-based access control, channel security and human user detection capabilities.

I downloaded acegi version 1.0.6 from

Extract the zip to a temp directory -

Extract the acegi-security-samples-tutorial-1.0.6.war to a temp directory

Copy this directory structure to OC4J e.g. to d:\oc4j

Update OC4J default-web-site.xml

Update OC4J application.xml

Restart OC4J


More info -

Monday, February 11, 2008

Leveraging AXIS web services on OC4J

Step 1 - Deploy axis to OC4J
Step 2 - Use it!

Step 1 - Deploy axis to OC4J

I'm using standalone OC4J
Download Apache AXIS from (I used the version 1.4)
Unzip to a directory of your choice e.g. D:\axis

Copy the axis sub-directory across to your OC4J installation

Update the OC4J default-web-site.xml file with the following entry -

Update the OC4J application.xml file with the following entry -

Stop/Start OC4J

Test by calling the following URL - http://localhost:8888/axis/

Creating a simple JAVA WEB Service

Create a simple java class in JDeveloper without a package structure e.g.

public class SayHi2U {
public SayHi2U() {
public String sayHi(String name){
return "Hi there " + name;
Copy the .java file to the axis sub-directory on OC4J
Rename from .java to .jws

Stop/Start OC4J

Test with the URL http://localhost:8888/axis/SayHi2U.jws

Standard Java Web Service Deployment

The simple java web service deployment, described in the previous section, is very limited. Standard deployment of Java Web Services is as follows –

Here we will use the CreditRatingChecker Class defined below

Create the following directory structure under the OC4J\axis sub-directory –

Copy the .class file, CreditRatingChecker.class, to this directory

Create the following file, deploy.wsdd, in the same directory

What is a wsdd? - Accroding to the Apache Axis doc -
To really use the flexibility available to you in Axis, you should get familiar with the Axis Web Service Deployment Descriptor (WSDD) format. A deployment descriptor contains a bunch of things you want to "deploy" into Axis - i.e. make available to the Axis engine. The most common thing to deploy is a Web Service...

We will use the AXIS admin client to „deploy“ the web service, but firstly we have to set the classpath etc.

Create a .bat file in the same directory with the following –

set AXIS_HOME=D:\AXIS\axis-1_4
set AXISCLASSPATH=%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery-0.2.jar;%AXIS_LIB%\commons-logging-1.0.4.jar;
set AXISCLASSPATH=%AXISCLASSPATH%;%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%\xml-apis.jar;%AXIS_LIB%\xercesImpl.jar
set classpath=%AXISCLASSPATH%;%classpath%

Open a DOS box in the directoy
Run your .bat file
Then enter the following cmd (-p is the Port directive)
java org.apache.axis.client.AdminClient deploy.wsdd -p 8888


Wednesday, January 30, 2008

BPEL - embedded Java

The example below shows a Java snippet defined in a BPEL Java activity

/* Start of Code snippet */

/*Write your java code below e.g.
System.out.println("Hello, World");

String status = "Bronze";

/* accessing a process variable of type string */
String country = (String)getVariableData("v_country");

/* accessing a variable within the complex type - customer */
Element country1 = (Element)getVariableData("inputVariable", "payload","/ns1:customer/ns1:Country");
String c1 = country1.getTextContent();

/* writes to the audit trail - will then be visible in BPEL console at runtime*/
addAuditTrailEntry("country is: " + country);
addAuditTrailEntry("country1 is: " + c1);

if (country.equalsIgnoreCase("Ireland")){
status = "Gold";

/* setting the output variable within the complex type - customer */
setVariableData("outputVariable", "payload",
"/ns1:customer/ns1:Status", status);

addAuditTrailEntry("status is: " + status);


/* End of Code snippet */
catch (Exception e) {

Add the following line before the bpelx:exec tag to import the Element class

Calling an external Java class in a Java activity

Jar up the Java class you want to use and copy the jarfile to the BPEL
system\services\lib directory.

In this example, my class is called CustomerStatus

/* Start of Code snippet */


String status = "Bronze";
String country = (String)getVariableData("v_country");

Element country1 = (Element)getVariableData("inputVariable", "payload","/ns1:customer/ns1:Country");

String c1 = country1.getTextContent();

addAuditTrailEntry("country is: " + country);
addAuditTrailEntry("country1 is: " + c1);

CustomerStatus cs = new CustomerStatus();
status = cs.getStatus(country);

setVariableData("outputVariable", "payload",
"/ns1:customer/ns1:Status", status);

addAuditTrailEntry("status is: " + status);


catch (Exception e) {

/* End of Code snippet */

add the following entries before the bpelx:exec tag

Using boolean in a BPEL Switch activity

v_approvalRequired is defined as a boolean

condition= "bpws:getVariableData('v_approvalRequired')=string(true())"

Wednesday, January 23, 2008

BPEL Fault Framework

Lab nn – BPEL Fault Framework
This simple lab introduces you to the fault framework and the configuration required to leverage the framework.
Release provides a generic fault management framework for handling faults in BPEL processes. If a fault occurs during runtime in an invoke activity in a process, the framework catches the fault and performs a user-specified action defined in a fault policy file associated with the activity. If a fault results in a condition in which human intervention is the prescribed action, you perform recovery actions from Oracle BPEL Control. The fault management framework provides an alternative to designing a BPEL process with catch branches in scope activities.
In this lab we will catch faults (business and runtime) for invoke activities.
Create a simple Web Service
· Create a Java class in JDeveloper called SayHi with a simple method such as –
package sayhi;
public class SayHi { public SayHi() { } public String sayHi(String name){ return "Hi There "+ name; }}
· Right-mouse click on the Java class and expose as a J2EE Web Service· Deploy to Oracle Application Server

Create a new Asynchronous BPEL process
· Create a new asynchronous BPEL process in JDeveloper

· Set input/output to –

<schema xmlns="" targetNamespace="http://www.niall.rentACar/" elementFormDefault="qualified" xmlns:tns="http://www.niall.rentACar/" xmlns:wsdl="" xmlns:xsi="" xmlns:soap11-enc="; <element name="rentCarElement"> <complexType> <sequence> <element name="name" type="string" nillable="true"/> <element name="pickup" type="string" nillable="true"/> <element name="return" type="string" nillable="true"/> <element name="dateOut" type="string" nillable="true"/> <element name="dateRtn" type="string" nillable="true"/> <element name="bookingCode" type="string" nillable="true"/> <element name="comments" type="string" nillable="true"/> </sequence> </complexType> </element></schema>
· Add a partner link for the SayHiService

· Add invoke

· Add Assign before the invoke to pass the name variable

· Add Assign after the invoke to copy input to output

· Open the RentACarProcess.wsdl file in JDeveloper

· Add the following line before the <types> element
<import namespace="" location="http://localhost:8888/orabpel/xmllib/RuntimeFault.wsdl;
This imports the RemoteException runtime fault that we will use later in the BPEL process.

· Create a new global variable – runtimeException

· Add a catch branch to the main

· Deploy to BPM and test
Set up the Fault Handler
· Make a copy of DefaultPolicy.xml

Here we will specify the default handling policies for the „default“ domain.
<Conditions> <!-- Fault if wsdlRuntimeLocation is not reachable --> <faultName xmlns:bpelx="" name="bpelx:remoteFault"> <condition> <action ref="ora-retry"/> </condition> <condition> <action ref="ora-human-intervention"/> </condition> </faultName> <!-- Fault if location port is not reachable--> <faultName xmlns:bpelx="" name="bpelx:bindingFault"> <condition> <action ref="ora-rethrow-fault"/> </condition> </faultName>
<!-- Business faults --><!-- Fault comes with a payload of error, make sure the name space--><!-- is provided here or at root level -->
· Add the ora-human-intervention action as detailed above.
· Also set the retryCount to 2 instead of 8 as detailed below.
<Action id="ora-retry"> <retry> <retryCount>2</retryCount> <retryInterval>2</retryInterval> <exponentialBackoff/> </retry> </Action>
· Amend fault-bindings.xml to point to your new policy file

· Undeploy the SayHi Web Service App so as to generate a remote fault

· Bounce the application server home instance· Go to the BPEL Console and clear the wsdl cache· Rerun the rentACarProcess

· Click on the Activities tab

· Perform manual recovery
Create rentACar Web Service
Create a new project in JDeveloper

· Create a Java class with the following methods

package rentacarservice;
public class RentACar { public RentACar() { } public String bookRentalCar(String pickup, String rtn, String dateOut, String dateRtn) throws NoRentalCarAvailableException{ String bookingRef = "AB2626"; if (dateOut.equals("251207")){ bookingRef = "Sorry no vehicles available"; throw new NoRentalCarAvailableException(bookingRef); } else { System.out.println("Car booked. Pickup at "+ pickup + " on " + dateOut + ". Return at " + rtn + " on " + dateRtn); return bookingRef; } } public String cancelRentalCar(String bookingRef){ System.out.println("Rental Booking "+ bookingRef + " has been cancelled"); return " Rental Booking " + bookingRef + " cancelled"; } }
· Create a new Java class - NoRentalCarAvailableException
package rentacarservice;
public class NoRentalCarAvailableException extends Exception { public NoRentalCarAvailableException() { super(); } public NoRentalCarAvailableException(String message) { super(message); }}
· Expose RentACar as a web service

· Deploy to Oracle Application Server· Test· Re-deploy the SayHi Service
Create new fault policy for Business error
<!-- Business faults --><!-- Fault comes with a payload of error, make sure the name space--><!-- is provided here or at root level -->
<faultName xmlns:tns="http://rentacarservice/"name="tns:NoRentalCarAvailableException"><condition><action ref="ora-human-intervention"/></condition></faultName>
· Bounce the home instance

Amend the BPEL Process to call the Car Rental Service
· Add Partner Link· Add Assign/Invoke· Add Catch Branch for the business error

· Deploy and Test

· Click on Activities tab