[EJB 3.0] - Timer Service
by liss_jboss
Hi!
I'm trying to create a schedule service at jboss 4.2.1 but I'm not sure what to do.
I need a service to be started by the application server that runs every half an hour.
I wrote a class but the problem is when I start jboss, I have the following error message:
anonymous wrote : 10:11:11,280 ERROR [TimerServiceImpl] Cannot create txtimer
| java.lang.IllegalStateException: Unable to persist timer
anonymous wrote : Caused by: java.sql.SQLException: Unique constraint violation: in statement [insert into TIMERS (TIMERID,TARGETID,INITIALDATE,TIMERINTERVAL,INSTANCEPK,INFO) values (?,?,?,?,?,?)]
Here is the class:
| @Service
| @Management(AtividadeTimerServiceManagement.class)
| public class AtividadeTimerServiceBean implements AtividadeTimerServiceLocal,
| AtividadeTimerServiceManagement {
|
| @Resource
| private TimerService timerService;
|
| public void create() throws Exception {
| this.timerService.createTimer(15*60*1000, 5*60*1000, null);
| }
|
| public void destroy() {
|
| }
|
| public void start() throws Exception {
| }
|
| public void stop() {
| }
|
| @Timeout
| public void monitorPeriodoCadastral(Timer timer) {
| log.info("monitorPeriodoCadastral...");
| }
| }
|
Does anybody have any idea why am I getting this error message?
Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127802#4127802
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127802
18 years, 2 months
[JBoss Seam] - Re: Schedule Reports to Run Daily at Certain Time
by JavaDeveloperX
You can configure your Jboss to not persist the timer:
in \server\default\deploy\ejb-deployer.xml change persistencePolicy to 'noop':
| <mbean code="org.jboss.ejb.txtimer.EJBTimerServiceImpl"
| name="jboss.ejb:service=EJBTimerService">
| <attribute name="RetryPolicy">jboss.ejb:service=EJBTimerService,retryPolicy=fixedDelay</attribute>
| <attribute name="PersistencePolicy">jboss.ejb:service=EJBTimerService,persistencePolicy=noop</attribute>
| <attribute name="TimerIdGeneratorClassName">org.jboss.ejb.txtimer.BigIntegerTimerIdGenerator</attribute>
| <attribute name="TimedObjectInvokerClassName">org.jboss.ejb.txtimer.TimedObjectInvokerImpl</attribute>
| <depends optional-attribute-name="TransactionManagerFactory" proxy-type="org.jboss.tm.TransactionManagerFactory">
| jboss:service=TransactionManager
| </depends>
| </mbean>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127796#4127796
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127796
18 years, 2 months