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.

http://www.thisisahmed.com/tia/bpel/checkjndibpel.html
http://www.thisisahmed.com/tia/esb/checkjndiesb.html

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"
    UIConnectionName="LocalDB"
    ManagedConnectionFactory="oracle.tip.adapter.db.DBManagedConnectionFactory"
    mcf.DriverClassName="oracle.jdbc.OracleDriver"
    mcf.PlatformClassName="oracle.toplink.platform.database.oracle.Oracle10Platform"
    mcf.ConnectionString="jdbc:oracle:thin:@//127.0.0.1:1521/orcl"
    mcf.UserName="scott"
    mcf.Password="9469F498BD53204FCC2CC246769B23C3"
    />
    </port>
    </service>
Recommendation?

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

4 comments:

  1. Hi Ahmed,

    We are using AIA 2.0.1 where the jms adapter is picking the message in standalone and not in cluster for the update customer flow. When analysed the value of UIConnectionName in the jca address is different in both when checked in the deployed wsdl.In standalone it is "jmsuser****Oracle" and in production it is "DBtest".Is this a issue?

    ReplyDelete
  2. Quester is a Pakistan-based questioning answering website where people can ask questions and we try our best to provide them with the best answers. Anyone can ask any legit question in English or Roman Urdu and we provide answers in the same language format. www.quester.pk

    ReplyDelete