Details
-
Bug
-
Resolution: Not a Bug
-
Major
-
None
-
10.0.0.Final, 10.1.0.Final
-
None
Description
The problem is that EntityManager does not have managed delegate within a job executed by ManagedScheduledExecutorService#scheduleAtFixedRate().
The EntityManager is produced by CDI producer and entire web application is able to work with injected EntityManager except for the jobs.
I tried to schedule executing the job in two ways and both finished with same issue (No managed context in EntityManager) :
- @ApplicationScoped job instance was passed to executor from caller.
- The job was changed to RequestScoped and ContextProxy#createContextualProxy() created the Job bean instance and then I called scheduleAtFixedRate(job, 5, 60, SECONDS)
It looks to me that javax.enterprise.concurrent has a different BeanManager and therefore has no notion about my CDI Producer of EntityManager. The producer is regular producer of EntityManager in JavaEE.