Changing JNDI Name Dynamically for a DB Adapter.
soa_adfOct 20 2010 — edited Jan 7 2012Hi,
I am trying to find a way to dynamically change the data-source on a BPEL(11.1.1.2) database partner-link call but so far I have been unsuccessful. In my test case, I created a simple DB partner-link running a very simple query against an Oracle database (defined as non-XA on weblogic server). On the Invoke to this partner-link, I tried setting the run-time properties of jca.db.DataSourceName and/or jca.db.XADataSourceName (both input and output) to the adapter jndi name defined on the server. When I run the BPEL process, it only tries to connect to the location attribute on the _db.jca file that JDeveloper created during design time and does not seem to acknowledge the properties I am setting.
I am not certain if this is the correct approach to achieve this, although If I remember correctly, similar approach worked on release SOA 11.1.1.1.
Here are a few of the code snippets from what I have done below.
Here is the source for invoke to the partner-link, getAppsDBName in BPEL:
<assign name="Assign_1">
<copy>
<from expression="'jdbc/b2bna'"/> <!—Assigning the adapter JNDI to a String variable -->
<to variable="dbName"/>
</copy>
</assign>
<invoke name="Invoke_getAppsDBName"
inputVariable="Invoke_getAppsDBName_InputVariable"
outputVariable="Invoke_getAppsDBName_OutputVariable"
partnerLink="getAppsDBName"
portType="ns5:getAppsDBName_ptt"
operation="getAppsDBName">
<bpelx:inputProperty name="jca.db.DataSourceName"
variable="dbName"/> <!—Setting the String variable on the invoke. I have also tried output. -->
</invoke>
Here is the getAppsDBNAME_db.jca that JDeveloper creates when the partner-link is defined:
<adapter-config name="getAppsDBName" adapter="Database Adapter" wsdlLocation="getAppsDBName.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
<connection-factory location="eis/DB/NADV" UIConnectionName="NADV" adapterRef=""/>
<endpoint-interaction portType="getAppsDBName_ptt" operation="getAppsDBName">
<interaction-spec className="oracle.tip.adapter.db.DBPureSQLInteractionSpec">
<property name="SqlString" value="select user_id, SYS_CONTEXT('USERENV','DB_NAME') app_db_name from fnd_user where user_name = 'MCS' "/>
<property name="GetActiveUnitOfWork" value="false"/>
</interaction-spec>
<input/>
<output/>
</endpoint-interaction>
</adapter-config>
In the file above, location="eis/DB/NADV" is not defined on the server so it fails with an error message.
Here is the binding fault text when the process runs:
The JCA Binding Component was unable to establish an outbound JCA CCI connection due to the following issue: BINDING.JCA-12510
JCA Resource Adapter location error.
Unable to locate the JCA Resource Adapter via .jca binding file element <connection-factory/>
The JCA Binding Component is unable to startup the Resource Adapter specified in the <connection-factory/> element: location='eis/DB/NADV'.
The reason for this is most likely that either
1) the Resource Adapters RAR file has not been deployed successfully to the WebLogic Application server or
2) the '<jndi-name>' element in weblogic-ra.xml has not been set to eis/DB/NADV. In the last case you will have to add a new WebLogic JCA connection factory (deploy a RAR).
Please correct this and then restart the Application Server
Please let me know if you have any additional questions regarding what I am trying to do.
Thanks in advance!