Connection factory JNDI name tips

Distributed computing environments often employ naming and directory services to obtain shared components and resources. Naming and directory services associate names with locations, services, information, and resources.

Naming services provide name-to-object mappings. Directory services provide information on objects and the search tools required to locate those objects. There are many naming and directory service implementations, and the interfaces to them vary.

Java Naming and Directory Interface (JNDI) provides a common interface that is used to access the various naming and directory services. After you have set this value, saved it, and restarted the server, you should be able to see this string when you invoke name space dump tool.

For WAS specifically, when you create a data source the default JNDI name is set to jdbc/data_source_name. When you create a connection factory, its default name is eis/j2c_connection_factory_name. We can, of course, override these values by specifying your own.

In addition, if you click the checkbox for the Use this data source for container managed persistence (CMP) option when you create the data source, another reference is created with the name of eis/jndi_name_of_datasource_CMP. For example, if a data source has a JNDI name of jdbc/myDatasource, the CMP JNDI name is eis/jdbc/myDatasource_CMP. This name is used internally by CMP and is provided simply for informational purposes.

When creating a connection factory or data source, a JNDI name is given by which the connection factory or data source can be looked up by a component. Preferably an "indirect" name with the java:comp/env prefix should be used and must be used in future releases. An "indirect" name makes any resource-reference data associated with the application available to the connection management runtime, to better manage resources based on the res-auth, res-isolation-level, res-sharing-scope, and res-resolution-control settings.

Though use a direct JNDI name, this naming method is deprecated in V6 of WebSphere Application Server. Application Server assigns default values to the resource-reference data when you use this method. An informational message, resembling the following, is logged to document the defaults

J2CA0294W: Deprecated usage of direct JNDI lookup of resource jdbc/IOPEntity.  The following default values are used: [Resource-ref settings]

  res-auth:                 1 (APPLICATION)
  res-isolation-level:      0 (TRANSACTION_NONE)
  res-sharing-scope:        true (SHAREABLE)
  loginConfigurationName:   null
  loginConfigProperties:    null
[Other attributes]

  res-resolution-control:   999 (undefined)
isCMP1_x:                 false (not CMP1.x)
isJMS:                 false (not JMS)


These default values can lead to unexpected behavior in your resources. For example, an application component (such as a JAAS login module) that accesses a resource with container-managed authentication data might fail to authenticate with the backend resource. Because the res-auth setting is assigned the default level of Application, rather than Container, the application server cannot find it.

This message can occur when you try using the fully qualified names of resources when looking up resources through Java Naming Directory Interface (JNDI). The J2EE programming model recommends the use of resource references and the local JNDI java:comp/env context. To correct this problem, modify the application to use the preferred J2EE programming model with resource references and the local JNDI java:comp/env context.


 

See Also


Connection factory
Data sources