Problem with TimerService
hasc Oct 6, 2007 11:03 AMHi,
i posted this question already in the seam forum, but i was told I should post the question here again...
I wrote a simple stateless bean to test the TimerService. i am using jboss 4.2.0GA
bean using the TimerService:
@Stateless
@Name("listener")
public class DBChangeListenerService implements DBChangeListener {
@Resource TimerService timerservice;
@Logger Log log;
public DBChangeListenerService() {}
public void initTimer() {
log.info("initTimer");
timerservice.createTimer(2*60*1000, 2*60*1000,"DBChangeListener");
}
@Timeout
public void queryState(Timer timer) {
log.info("query db state");
}
}
and the bean calling the initTimer() method:
@Stateless
@AutoCreate
@Name("objectcache")
public class ObjectCacheService implements ObjectCache{
@In(create=true)
DBChangeListenerService listener;
public void init() {
listener.initTimer();
}
}When the init() method is called the following exception is trhrown:
2007-10-02 14:56:55,437 ERROR [org.jboss.ejb.txtimer.TimerServiceImpl] Cannot create txtimer java.lang.IllegalStateException: Unable to persist timer at org.jboss.ejb.txtimer.DatabasePersistencePolicy.insertTimer(DatabasePersistencePolicy.java:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) ... ... at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241) at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437) at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:381) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:595) Caused by: org.jboss.util.NestedSQLException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to en list resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: -3f57fdff:555:47023fba:53 status: ActionStatus.ABORT_ONLY >); - nested throwable: (org.jboss.resource.JBossResourceException: Could not enlist in transaction o n entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Thr owable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: -3f57fdff:555:47023fba:53 status: ActionStatus.ABORT_ONLY >)) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94) at org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin.insertTimer(GeneralPurposeDatabase PersistencePlugin.java:199) at org.jboss.ejb.txtimer.DatabasePersistencePolicy.insertTimer(DatabasePersistencePolicy.java:120) ... 317 more Caused by: org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering me ta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabl ed to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: -3f57fdff:555:47023fba:53 status: ActionStatus.ABORT_ONLY >) at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnecti onManager.java:343) at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnectManagedConnection(BaseConne ctionManager2.java:518) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionMan ager2.java:399) at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConne ction(BaseConnectionManager2.java:842) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88) ... 319 more Caused by: javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see t he previous warnings. tx=TransactionImple < ac, BasicAction: -3f57fdff:555:47023fba:53 status: ActionStatus.ABORT_ONLY > at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener$TransactionSy nchronization.checkEnlisted(TxConnectionManager.java:744) at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConn ectionManager.java:577) at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnecti onManager.java:337) ... 323 mor
any tips would be great.
Thanks and regards,
hasc