title: Propagate Java EE context Websphere
body: <p>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 Java EE context required for jndi lookups. The error that I get is:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>There is feature in Java EE 7 for ManagedExecutorService that can be configured in websphere. I am not able to use that as Websphere 8.5 supports Java EE 6 only. I am not able to do the lookups in advance as there are third party jars included that need the Java EE context to work.</p>
  
  <p>I want to propagate Java EE context to the newly spawnned thread. Please suggest if that is possible.</p>