3 Replies Latest reply on Feb 10, 2009 7:36 AM by dimitris

    Configuring ejb3-timer-service.xml (JBoss 5.0.0.CR1)

    wdfink

      I try to use the EJB3 timer service with Oracle DS.

      First of all I have to use a non XA connection, is the XA protocol not needed?

      If I use a local-tx-datasource the table can not created because of an illegal data type.
      The Statement:

      CREATE TABLE QRTZ_JOB_DETAILS(JOB_NAME VARCHAR(80) NOT NULL, JOB_GROUP VARCHAR(80) NOT NULL, DESCRIPTION VARCHAR(120) NULL, JOB_CLASS_NAME VARCHAR(128) NOT NULL, IS_DURABLE VARCHAR(1) NOT NULL, IS_VOLATILE VARCHAR(1) NOT NULL, IS_STATEFUL VARCHAR(1) NOT NULL, REQUESTS_RECOVERY VARCHAR(1) NOT NULL, JOB_DATA BINARY NULL, PRIMARY KEY (JOB_NAME,JOB_GROUP))

      will not work. The type BINARY is not valid for Oracle.

      Do I have to patch the ejb3-timer-service.xml if I change the DB for it or is there a configuration for the different DB types?

        • 1. Re: Configuring ejb3-timer-service.xml (JBoss 5.0.0.CR1)
          peterj

          You need to do several things, so pardon my quoting from JBoss In Action (http://www.manning.com/jamae), chapter 15:

          The first thing you'll need to do is download the Quartz source file that corresponds to the version provided by JBoss AS. You can determine the Quartz version by examining the META-INF/Manifest.mf file located in the server/xxx/lib/quartz.jar file.

          With the Quartz source code at hand, you need to change two things in the server/xxx/deploy/ejb3-timer-server.xml file.

          First, the ejb3-timer-server.xml file contains a list of Quartz properties. You're interested in this property:

          org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate

          You need to change the delegate class to match the one for your database. The valid delegates can be found in the src/java/org/quartz/impl/jdbcjobstore directory of the Quartz source. For example, use the PostgreSQLDelegate class for a PostgreSQL database. If there’s no delegate specific to your database, as is the case for MySQL, use the StdJDBCDelegate class. For example, for MySQL this delegate property would be

          org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate

          The second change is more complicated. The SqlProperties attribute in the ejb3-timer-server.xml file contains a list of SQL statements used to create and initialize the tables in the database. You need to replace these SQL statements with the ones for your database. You can find the correct statements in the Quartz sources in the docs/dbTables directory. For example, use the tables_postgres.sql file for a PostgreSQL database.
          When replacing the SQL statements, leave the CREATE_* property name on the line. For example, the property to create the job details table would look like

          CREATE_TABLE_JOB_DETAILS = CREATE TABLE qrtz_job_details(...);

          where the CREATE TABLE qrtz_job_details(...); text comes from the tables_*.sql file for your database.

          For MySQL users, note that the tables_mysql.sql file uses uppercase letters for the table names. If you’re running MySQL on Unix/Linux, make sure you make that change because MySQL table names are case-sensitive on those platforms.



          • 2. Re: Configuring ejb3-timer-service.xml (JBoss 5.0.0.CR1)

            Hi
            i am getting the same exception, tried things u hav mentioned above but didnt work out for me. i am using oracle. i changed the dialect and scripts.
            here is the log :

            08:43:15,604 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
            08:43:15,619 INFO [RAMJobStore] RAMJobStore initialized.
            08:43:15,619 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
            08:43:15,619 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
            08:43:15,619 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
            08:43:15,807 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=myDB' to JNDI name 'java:myDB'
            08:43:17,136 WARN [QuartzTimerServiceFactory] sql failed: CREATE TABLE qrtz_job_details
            08:43:17,167 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
            08:43:17,167 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
            08:43:17,167 INFO [JobStoreCMT] Using db table-based data access locking (synchronization).
            08:43:17,183 ERROR [AbstractKernelController] Error installing to Start: name=jboss.ejb:service=EJB3TimerService state=Create mode=Manual requiredState=Installed
            org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: ORA-00942: table or view does not exist
            [See nested exception: java.sql.SQLException: ORA-00942: table or view does not exist
            ]]
            at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:493)
            at org.quartz.impl.jdbcjobstore.JobStoreCMT.initialize(JobStoreCMT.java:144)
            at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1010)
            at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1152)
            at org.jboss.ejb3.timerservice.quartz.QuartzTimerServiceFactory.start(QuartzTimerServiceFactory.java:258)
            at org.jboss.ejb3.timerservice.quartz.jmx.EJB3TimerService.startService(EJB3TimerService.java:105)

            kindly help....

            • 3. Re: Configuring ejb3-timer-service.xml (JBoss 5.0.0.CR1)
              dimitris

              Just get rid of ejb3-timer-service.xml, i.e. remove it.

              Ejb3 is configured by default to use the ejb2.x timer service and that should work.