Hi,

I'm looking for a correct way to use an EntityManager inside a  thread of 
JBossAS. I have a EJB3 service object that spins a thread to handle a request. 
Inside the thread I need to perform a named query using an EntityManager. I 
tried passing an EntityManager that was obtained using injection in the service 
object or an EntityManager that was obtained using JNDI lookup inside the 
thread. But whichever EntittyManager that I obtained, I always get the 
following error when performing .createNamedQuery on the EntityManager. Any 
suggetion?

23:50:53,765 ERROR [STDERR] java.lang.NullPointerException
23:50:53,765 ERROR [STDERR]     at 
org.jboss.ejb3.entity.ManagedEntityManagerFactory.getNonTxEntityManager(ManagedEntityManagerFactory.java:59)
23:50:53,765 ERROR [STDERR]     at 
org.jboss.ejb3.entity.ManagedEntityManagerFactory.getTransactionScopedEntityManager(ManagedEntityManagerFactory.java:164)
23:50:53,765 ERROR [STDERR]     at org.jboss.ejb3.entity.TransactionScopedEntity
Manager.createNamedQuery(TransactionScopedEntityManager.java:132)
23:50:53,765 ERROR [STDERR]     at 
coco.nms.router.HeartbeatPacketWorker.getRouter(HeartbeatPacketWorker.java:92)


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4015651#4015651

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4015651
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to