Troubleshooting
Problem
Performing a JNDI lookup on a database connection on a thread other than the IBM WebSphere Application Server thread (For example: a WebContainer thread) is not supported.
Cause
A spawned thread does not inherit the J2EE context. It is not possible to do an indirect JNDI lookup (that is, a lookup using a java:comp/env reference), since the resource references are part of the J2EE context. It is possible to perform a direct lookup using the spawned thread. But it is not technically supported according to the J2EE specification.
Resolving The Problem
Using a Java™ call such as "newThread()" to spawn a new thread is not supported according to the J2EE specification. This spawned thread does not inherit the J2EE context. What is recommended to do instead is to use an asynchronous bean or Commonj WorkManager thread. These threads have a proper J2EE context and support an indirect JNDI lookup.
Historical Number
60940;344;000
Was this topic helpful?
Document Information
Modified date:
15 June 2018
UID
swg21246676