IBM Support

JDBC Data Source Reference cannot be attached from Business Process snippet code

Troubleshooting


Problem

In WebSphere Integration Developer it is possible to define your own JDBC Data Source References in the EJB Deployment Descriptor. If you try to connect the source references from a Java component it succeeded whereas the same call from a Java™ snippet located in a Business Process (For example: 'Visual Snippet') failed.

Symptom

To create such a Source Reference, open the WebSphere Integration Developer's Deployment Editor (right mouse click on the module name and select from the context menu " Open Deployment Editor") and add a reference entry to the JDBC Data Source References section. These references are valid and implemented in the ejb-jar.xml file for the 'Module' scope.


As soon as a Reference was created a new entrie in the 'Module' section of the ejb-jar.xml file will be added.


A try to access the References from a Java component and from a BPEL
process component with custom Java code

...
try {
ctx = new javax.naming.InitialContext();
ds = (DataSource) ctx.lookup("Javacomp/env/DataSourceAlias");
}
...

delivers following results



javax.naming.NameNotFoundException:
Context: widCell/nodes/widNode/servers/server1,name: DataSourceAlias: First component in name DataSourceAlias not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound:IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]”

Cause

To make sure that the different components can use the ResourceReferences these information will be added to a generated Java Bean. This works well for a Java component but, unfortunately, not for the BPC Java Bean. In this case the reference link will not be available in the BPC Java Bean.
This is a limitation in a V6.x environment and solved in V7.0

Resolving The Problem

A way to workaround this limitation is to use a global jdbc name instead of reference names. So if you have created a source reference 'DataSourceAlias' with a jndi name 'jndi/123' you should change your custom code as follows in your BPEL snippet:

old:
ds = (DataSource) ctx.lookup("java:comp/env/DataSourceAlias")

new:
ds = (DataSource) ctx.lookup("jndi/123")

[{"Product":{"code":"SSQQFK","label":"WebSphere Integration Developer"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Not Applicable","Platform":[{"code":"PF033","label":"Windows"}],"Version":"6.2.0.2;6.2.0.1;6.2;6.1.2;6.1.0.1;6.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21423615