There are different ways to configure Flux to run inside WebSphere.
- WebSphere 4.0 Custom Service. WebSphere 4.0 has a mechanism called a Custom Service. IBM recommends Custom Services for starting services when WebSphere starts. In WebSphere 3.5, this mechanism was called a Service Initializer. In WebSphere 4.0, the Custom Service was introduced. The downside to Custom Services is that when they start, none of WebSphere’s J2EE functionality is available for use. For this reason, Flux cannot be initialized to use WebSphere database connections.
Due to this reason, it is recommended that when using WebSphere 4.0, you use one of the above configuration options that work across all application servers.
- WebSphere 5.0 Startup Bean. WebSphere 5.0 introduced a startup mechanism called a Startup Bean. Presumably, this startup mechanism replaces the WebSphere 4.0 Custom Service, which had severe limitations.
You can use a WebSphere 5.0 Startup Bean to instantiate and initialize Flux 5.3 with database connections provided by a WebSphere 5.0 data source.
In any case, it is always appropriate to initialize Flux with WebSphere using one of the general startup mechanisms described in (cross reference). Because those general startup mechanisms work across all application servers, you may choose to use them with WebSphere for simplicity or portability.
Flux 6.1 has been tested successfully with WebSphere 5.1, and Flux 5.3 has been tested successfully with WebSphere 5.0. While testing Flux with WebSphere 5.0, we have found the following caveats.
- Configure Flux to use a “direct” data source name such as jdbc/MyDataSource. Do not use an “indirect” data source name such as java:comp/env/jdbc/MyDataSource.
- When Flux retrieves a database connection from a WebSphere 5.0 data source, you will see an informational message printed on the WebSphere 5.0 console. This message is neither an error message nor a warning message. It is simply a WebSphere 5.0 informational message advising you of what assumptions WebSphere 5.0 has made in association with the retrieved database connection.
This WebSphere 5.0 informational message is as follows.
Resource reference jdbc/MyDataSource could not be located, so default values of the following are used: [Resource-ref settings] res-auth: 1 (APPLICATION) res-isolation-level: 0 (TRANSACTION_NONE) res-sharing-scope: true (SHAREABLE) res-resolution-control: 999 (undefined)
An active transaction should be present while processing method.
IBM has provided further details on this WebSphere 5.0 informational message below:
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 run dumpnamespace.
For WebSphere Application Server 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. You can, of course, override these values by specifying your own.
In addition, if you click the checkbox Use this data source for container managed persistence (CMP) 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. Generally an “indirect” name with the java:comp/env prefix should be used. This 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.
While the use of a direct JNDI name is supported, such use results in default values of these resource-ref data. You will see an informational message logged such as this:
J2CA0122I: Resource reference abc/myCF could not be located, so default values of the following are used: [Resource-ref settings] res-auth: 1 (APPLICATION) res-isolation-level: 0 (TRANSACTION_NONE) res-sharing-scope: true (SHAREABLE) res-resolution-control: 999 (undefined) <end-of-IBM-web-page>
If you are using Flux within a J2EE 1.3 web application and V5 data sources inside WebSphere 5.x, you should use the default setting for the DATA_SOURCE_USER_TRANSACTION_CLIENT_JNDI_NAME configuration option. Also, set the DATA_SOURCE_USER_TRANSACTION_SERVER_JNDI_NAME configuration option to jta/usertransaction.