How to implement EJB timer service for a non-clustered standalone server in Wildfly 8.2.0 AS
sridharthiyagarajan Jun 25, 2015 8:01 AMHello,
I am migrating the EAR application from JBoss AS 6 to Wildfly AS 8.2.0. While doing, I am facing a concern on implementing EJB timer service in Wildfly AS for the datasource TestSybaseDB defined in standalone-full-ha.xml.
FYI that below are the files related to JBoss AS 6 related to EJB3 timer service implementation for the datasource TestSybaseDB. In below files of JBoss 6 AS, datasource name is defined and I believe these changes are enough for implementation of EJB timer service in JBoss 6 AS for a database.
persistence.xml
path: ${JBOSS_HOME}\common\deploy\jboss-ejb3-timerservice-mk2.jar\META-INF\persistence.xml
ejb2-timer-service.xml
path: ${JBOSS_HOME}/server/default/deploy/ejb2-timer-service.xml
I am running Wildfly 8.2.0 in non-clustered mode using standalone-full-ha.xml and the database used is Sybase. I performed the below steps:
1. Converted SQL code in timer-sql.properties available in the below location as per Sybase syntax.
${WILDFLY_HOME}\modules\system\layers\base\org\jboss\as\ejb3\main\timers
2. Modified the subsystem <subsystem xmlns="urn:jboss:domain:ejb3:2.0"> to add new data-store entry as changes are highlighted in bold.
<timer-service thread-pool-name="timer" default-data-store="clustered-store">
<data-stores>
<database-data-store name="clustered-store" datasource-jndi-name="java:/TestSybaseDB" database="sybase" />
</data-stores>
</timer-service>
The table JBOSS_EJB_TIMER got created when starting the server for the first time after making above changes. After that, whenever I start the server, I am getting the below exception whenever I start the server.
Can anyone please help me to configure a EJB TIMER SERVICE for a non-clustered Wildfly server running in standalone mode (with standalone-full-ha.xml).
ERROR [org.jboss.as.ejb3] (MSC service thread 1-3) JBAS014263: Cannot create table for timer persistence: com.sybase.jdbc4.jdbc.SybSQLException: There is already an object named 'JBOSS_EJB_TIMER' in the database.
at com.sybase.jdbc4.tds.Tds.a(Unknown Source)
at com.sybase.jdbc4.tds.Tds.nextResult(Unknown Source)
at com.sybase.jdbc4.jdbc.ResultGetter.nextResult(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.updateLoop(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.executeUpdate(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.executeUpdate(Unknown Source)
at org.jboss.jca.adapters.jdbc.WrappedStatement.executeUpdate(WrappedStatement.java:375)
at org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.runCreateTable(DatabaseTimerPersistence.java:150) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.start(DatabaseTimerPersistence.java:117) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]