2 Replies Latest reply on Oct 3, 2008 6:01 AM by Rai Kankas

    How to access EntityManager in a Thread run() method?

    Rai Kankas Newbie

      Hi,

      I have got an Enterprise project with an EJB3, I am starting a Thread in a @Stateless bean but when I try to use my EJB3 EntityManager I get below exception.

      How can I access from inside the Thread to my EntityManager?

      :01:35,812 ERROR [STDERR] Exception in thread "Thread-15"
      20:01:35,812 ERROR [STDERR] java.lang.NullPointerException
      20:01:35,812 ERROR [STDERR] at org.jboss.ejb3.entity.ManagedEntityManagerFactory.getNonTxEntityManager(ManagedEntityManagerFactory.java:59)
      20:01:35,812 ERROR [STDERR] at org.jboss.ejb3.entity.ManagedEntityManagerFactory.getTransactionScopedEntityManager(ManagedEntityManagerFactory.java:164)
      20:01:35,812 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManager.createQuery(TransactionScopedEntityManager.java:132)
      20:01:35,812 ERROR [STDERR] at com.indra.localiza.ejb.modules.controlledtags.TagsControllerThread.run(TagsControllerThread.java:59)


      Thanks in advance!