You should not introduce stateless EJBs in stateless EJBs. This can have very unpredictable consequences, as the state-run EJB starts when injected and managed using a bean. In the worst case, stateless EJBs can be reused by the application server for different users, which will then access the same EJB state. In your case, the user will be identified as another user.
Most likely, you want to associate the EJB with the state with the current HTTP session, which is not performed automatically, as many people believe. For more information, read the section titled EJB 3 Is Not Contextual here: Contexts and Dependence on Injection Articles
To associate an EJB with state in a session, you need to enter an EJB with state in a CDI bean with session coverage that can be freely entered into a stand-alone bean - in fact, only a stub is entered and the bean session area (along with the EJB with state) is created for each new session.
Perhaps even a better approach is to extract the stateful bean interface and use the CDI manufacturer to create a realistic implementation of the sateful bean with the session. That way, you can also deal with this case where a standalone EJB is automatically removed from an exception in an EJB. In this case, you may want to recreate the EJB during the same session.
source share