Hi, I have a scenario as follows:
1) JAX-RS request comes into TomEE 8.0.0 and hits a stateless EJB of mine 2) The EJB has an object called UserContext injected which is @RequestScoped 3) userContext in turn injects HttpServletRequest with @Context 4) I use userContext fine. All is good and it can access the HttpServletRequest 5) My EJB does a rest call to another system. This rest call uses asynhttp with reactive programming and returns a CompletionStage. 6) my EJB code does a .thenAccept on the completionstage and in this code we try and use the injected UserContext. Here we get an error when UserCOntext tries to use HttpServletRequest. java.lang.IllegalStateException: No CXF message usable for JAX-RS @Context injections in that thread so can't use interface javax.servlet.http.HttpServletRequest I believe this is due to the completionstage being executed on a different thread. E.g.. steps 1-5 use TomEE-Exec-1 while step 6 uses async-http-3-3. To resolve this I got UserContext to eagerly load the data it needs from HttpServletRequest in step 3 so that at step 6 no calls to HttpServletRequest are needed. It seems though that the userContext is proxied by webbeans and I get a different instance on the different thread and this new instance has none of my eagerly loaded data in it. Does anyone know how to resolve this issue. Basically I want to somehow get step 6 to use the exact instance of UserContext as step 2 even though they are on different threads. Paul Carter-Brown Director Jini Guru m: +27 (0) 83 442 7179 <+27834427179> a: 1st Floor, Golf House, Design Quarter, Cnr. William Nicol and Leslie Johannesburg, South Africa w: jini.guru e: p...@jini.guru Disclaimer: This message and/or attachment(s) may contain privileged, confidential and/or personal information. If you are not the intended recipient you may not disclose or distribute any of the information contained within this message. In such case you must destroy this message and inform the sender of the error. Jini Guru may not accept liability for any errors, omissions, information and viruses contained in the transmission of this message. Any opinions, conclusions and other information contained within this message not related to Jini Guru official business is deemed to be that of the individual only and is not endorsed by Jini Guru.