views:

42

answers:

1

Hey fellows,

I've been getting a load of rollbackexception when calling some SELECT JPQL or namedqueries from a Singleton. The Singleton as one method with the @Schedule annotation calling the some others db query which run fine. But once that shceduled method calls on some other methods which at their turn call db queries then everything goes ugly.

A simple Servlet calling the exact same method in the same EE app returns eerything fines.

So what can go wrong in my Singleton to cause those? Snippet from the error stack:

Client's transaction aborted at com.sun.ejb.containers.BaseContainer.useClientTx(BaseContainer.java:4625) at com.sun.ejb.containers.BaseContainer.preInvokeTx(BaseContainer.java:4503) at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1875) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:188) at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84) at $Proxy216.remove(Unknown Source) at com.sun.ejb.containers.EJBTimerService.removeTimerBean(EJBTimerService.java:1518) at com.sun.ejb.containers.EJBTimerService.expungeTimer(EJBTimerService.java:995) at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1718) at com.sun.ejb.containers.EJBTimerService.access$100(EJBTimerService.java:98) at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:2485) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)

A: 

Hey, Nope it's left to default so REQUIRED. The situation is the following: I have a Singleton bean with a @Schedule method which generate xml files from values extracted from the database. To do so it calls a session bean (Stateless) with a method performing the following query:

getEntityManager().createQuery("SELECT m FROM Member1 m WHERE (m.memberStatus) = ?1 AND (m.joinedDate) = ?2 AND UPPER (m.country) = ?3").setParameter(1, true).setParameter(2, yesterday).setParameter(3, country.toUpperCase()).getResultList();

Benjamin M