The problem is that you are trying to run Thread on the Java EE application server. Hand threading is a violation of the Java EE specifications, so you run into problems. on some application servers you cannot even start a separate thread. From the specification:
A bean should not attempt to manage flows. A bean should not attempt to start, stop, pause, or resume a stream or change the priority or name of a stream. A bean should not attempt to manage thread groups. These functions are reserved for the EJB container. Allowing bean enterprises to manage flows will reduce the ability of containers to properly manage the runtime.
If you need to work on a separate thread, you need to use the tools provided by the application server for asynchronous work. some parameters represent the queue in the JMS queue for processing MDB or, possibly, using an asynchronous ejb request (I think that in Java EE 6).
source share