November 7, 2008

One issue I faced at a current client was JNDIs being referenced in BPEL/ESB code. Time and time again, BPEL processes and ESB services written by less experienced SOA developers referenced JNDIs that were not configured on the Application Server. This caused continuous errors in the logs. This also was of particular concern due to their being a single shared Dev environment.

As a result, it was decided to script a procedure that parsed each deployed service, and checked whether it referenced an existing JNDI or not. If it did not, an email would be automatically sent to the development lead notifying him of the details.

The script also generates a CSV file with more detailed information (includes project name, WSDL that was parsed, JNDI, ESB service names, ESB GUIDs):The Logic Behind the Scripts

For BPEL processes, the logic is simply as follows:

BPEL processes are deployed to project subdirectories located in $ORACLE_HOME/bpel/domains/<domain>/tmp.

Parse the WSDL files in each deployed BPEL process.

Browse for JNDI locations, which take the format <jca:address location="...>.

Cross-reference the JNDIs with actual JNDIs configured on the Application Server (the oc4j-ra.xml files for the adapters are located under $ORACLE_HOME/j2ee/oc4j_soa/application-deployments/default/<adapter>).

If a JNDI used in a BPEL process is not configured on the Application Server, then note the JNDI name, the WSDL file it was located in, and the BPEL process and version it belongs to.

For ESB services, the logic is as follows:

When ESB projects are registered to the ESB server, they are deployed as zip files under $ORACLE_HOME/integration/esb/oraesb/deploy.

Extract the zip files in a temporary location, and parse the WSDL files in each deployed ESB project.

Browse for JNDI locations, which take the format <jca:address location="...>.

Cross-reference the JNDIs with actual JNDIs configured on the Application Server (the oc4j-ra.xml files for the adapters are located in $ORACLE_HOME/j2ee/oc4j_soa/application-deployments/default/<adapter>).

If a JNDI used in the ESB project is not configured on the Application Server, then note the JNDI name, the WSDL file it was located in, the ESB service(s) it belongs to, the GUIDs for the ESB service(s) (needed if you want to undeploy it via ant).