August 25, 2009

Check JNDIs in Oracle Application Server against deployed BPEL & ESB code

The links below provide scripts on how to automatically compare JNDIs configured on the Oracle Application Server against those used within your BPEL processes or ESB services.

What is the importance of these scripts?

If BPEL or ESB code deployed to your server is using an invalid or non-existent JNDI, then it defaults to the MCF properties configured within that adapter.

This could be an issue in the following scenario.

Let's say that you have both a Dev and a Test environment, and the admins have instructed the developers to use the JNDI "eis/DB/LocalDBScott". On each of the environments, the JNDI is configured to point to a different database. Now, many developers rely on JDeveloper to configure their connections, often ignoring the value of the JNDI. This hardcodes the username/password/database connect information within the process itself (via MCF properties). If this same code is deployed to Test, when executed it would connect to your Dev database!

The usage behavior is as follows:
1. If the MCF properties are defined, the BPEL/ESB process uses them to connect.
2. If the MCF properties are defined but invalid, the BPEL/ESB process uses the JNDI to connect.
3. If the MCF properties are not defined, the BPEL/ESB process uses the JNDI to connect.

What are MCF properties?

MCF stands for "Managed Connection Factories".

When configuring a Database Adapter or AQ Adapter via the Adapter Configuration Wizard, a Database Connection is required to configure the adapter (this is already defined in your project). The Connection Information listed is actually pulled from your JDeveloper Database Connection information.

Once the adapter is created, a WSDL file is automatically created that includes the adapter definition. This includes the Managed Connection Factory (MCF) properties as well as the Java Naming and Directory Interface (JNDI) name, as shown below:
    <service name="UpdateCustTable">
    <port name="UpdateCustTable_pt" binding="tns:UpdateCustTable_binding">
    <jca:address location="eis/DB/LocalDBScott"

Always manually remove MCF properties from your code once development is complete.