6 Replies Latest reply on Feb 20, 2009 10:06 PM by Zoltan Tiringer

    EntityManager closed in Application scoped EntityQuery component

    Zoltan Tiringer Newbie

      I have an application scoped EntityQuery component that gets registered with Quartz after startup to do some regular DB scan (and un/register some other components with Quartz). The first time this component executes OK (I can see the logs), but all subsequent invocations fail with IllegalStateException: EntityManager closed. I have auto-create true at managed persistence context in components.xml


      I tried setting entityManager to null at the end of the constructor logic, to force getting a new entityManager, the same with @PrePassivate - no success. I tried even @In (create=true) to inject entityManager (though EntityQuery doesn't need this).


      When registering a Conversation scoped component with Quartz, it works just fine.


      What am I doing wrong? How do I workaround this? Is this expected behavior or a bug?