mardi 26 mai 2015

Propagate J2EE context Websphere

I am working on Jersey based JAX-RS2 app running on Websphere 8.5. I am using async feature to spawn a new thread. The issue is that the new thread is not getting the j2ee context required for jndi lookups. The error that I get is:

A JNDI operation on a java:comp/env name cannot be completed because the current thread is not associated with a Java Enterprise Edition application component. This condition can occur when the JNDI client using the java:comp/env name does not occur on the thread of a server application request. Make sure that a Java EE application does not run JNDI operations on java:comp/env names within static code blocks or in threads created by that application. Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on java:comp/env names.

There is feature in J2EE 7 for ManagedExecutorService that can be configured in websphere. I am not able to use that as Websphere 8.5 supports J2EE 6 only. I am not able to do the lookups in advance as there are third party jars included that need the j2ee context to work.

I want to propagate j2ee context to the newly spawnned thread. Please suggest if that is possible.

Aucun commentaire:

Enregistrer un commentaire