Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-606

Tables for JDBC Batch repository are created twice

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 7.0.0.DR8
    • Component/s: Batch
    • Labels:
      None
    • Target Release:
    • Steps to Reproduce:
      Hide

      Create a data source to a sybase, oracle, or db2 database and create a JDBC job repository out of it.

      Show
      Create a data source to a sybase, oracle, or db2 database and create a JDBC job repository out of it.

      Description

      The constructor of org.wildfly.extension.batch.jberet.job.repository.JdbcJobRepositoryService is called twice: https://github.com/wildfly/wildfly/blob/80247ada8e7daa46660c732c4fc927e26f055d76/batch/extension-jberet/src/main/java/org/wildfly/extension/batch/jberet/job/repository/JdbcJobRepositoryService.java#L69 (both lines 56 and 69 typically get executed). Two threads then race to create the tables.

      Some databases can deal with it (those which support IF NOT EXISTS clause in the CREATE TABLE query). But where this is not used, creating a JDBC Batch repository fails with

      15:21:31,526 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 29) MSC000001: Failed to start service org.wildfy.batch.job.repository.jdbc: org.jboss.msc.service.StartException in service org.wildfy.batch.job.repository.jdbc: WFLYBATCH000011: Failed to create JDBC job repository.
      	at org.wildfly.extension.batch.jberet.job.repository.JdbcJobRepositoryService.lambda$start$1(JdbcJobRepositoryService.java:59)
      	at org.wildfly.extension.batch.jberet.job.repository.JdbcJobRepositoryService$$Lambda$12/1223050080.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      	at org.jboss.threads.JBossThread.run(JBossThread.java:320)
      Caused by: javax.batch.operations.BatchRuntimeException: JBERET000624: Failed to create tables for batch job repository database product name Adaptive Server Enterprise with DDL sql/jberet-sybase.ddl
      	at org.jberet.repository.JdbcRepository.createTables(JdbcRepository.java:281)
      	at org.jberet.repository.JdbcRepository.<init>(JdbcRepository.java:205)
      	at org.jberet.repository.JdbcRepository.<init>(JdbcRepository.java:167)
      	at org.wildfly.extension.batch.jberet.job.repository.JdbcJobRepositoryService.lambda$start$1(JdbcJobRepositoryService.java:56)
      	... 5 more
      Caused by: java.sql.BatchUpdateException: JZ0BE: BatchUpdateException: Error occurred while executing batch statement: There is already an object named 'JOB_INSTANCE' in the database.
      
      	at com.sybase.jdbc4.jdbc.ErrorMessage.raiseBatchUpdateException(ErrorMessage.java:1300)
      	at com.sybase.jdbc4.jdbc.SybStatement.batchLoop(SybStatement.java:2134)
      	at com.sybase.jdbc4.jdbc.SybStatement.sendBatch(SybStatement.java:1924)
      	at com.sybase.jdbc4.jdbc.SybStatement.executeBatch(SybStatement.java:1882)
      	at com.sybase.jdbc4.jdbc.SybStatement.executeBatch(SybStatement.java:1691)
      	at org.jboss.jca.adapters.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:1174)
      	at org.jberet.repository.JdbcRepository.createTables(JdbcRepository.java:279)
      	... 8 more
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jmartisk Jan Martiska
                  Reporter:
                  jmartisk Jan Martiska
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: