2

最近、grails アプリを Quartz スケジューラーで使用するように構成しようとしました。残念ながら、JDBC ジョブ ストアの構成に失敗しました。Quartz プラグインはquartz.properties、テーブル プレフィックスが として定義されているファイルを無視するようですZ_STAFF_SCHEDULER。アプリケーションの起動は例外で失敗します:

原因: org.springframework.scheduling.SchedulingException: Quartz Scheduler を開始できませんでした。ネストされた例外は org.quartz.SchedulerConfigException: ジョブの回復中にエラーが発生しました。[ネストされた例外を参照してください: org.quartz.impl.jdbcjobstore.LockException: データベース行ロックの取得に失敗しました: テーブル 'testing.qrtz_locks' が存在しません [ネストされた例外を参照してください: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: テーブル ' testing.qrtz_locks' は存在しません]]

関連するコードは次のapplication.groovyとおりです。

quartz {
    autoStartup = true
    jdbcStore = true
    waitForJobsToCompleteOnShutdown = true
    exposeSchedulerInRepository = false

    props {
        scheduler.skipUpdateCheck = true
    }

}

environments {
    test {
        quartz {
            jdbcStore = false
            autoStartup = false
        }
    }
}


grails.config.locations = ["classpath:conf/quartz.properties"]

これは私の設定ですquartz.properties

#============================================================================
# Configure Main Scheduler Properties
#============================================================================

org.quartz.scheduler.instanceName = StaffScheduler
org.quartz.scheduler.instanceId = AUTO

#============================================================================
# Configure ThreadPool
#============================================================================

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 25
org.quartz.threadPool.threadPriority = 5

#============================================================================
# Configure JobStore
#============================================================================

org.quartz.jobStore.misfireThreshold = 60000

org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = development
org.quartz.jobStore.tablePrefix = Z_STAFF_SCHEDULER_

org.quartz.jobStore.isClustered = true
org.quartz.jobStore.clusterCheckinInterval = 20000

#============================================================================
# Configure Datasources
#============================================================================


org.quartz.dataSource.development.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.development.URL = jdbc:mysql://localhost:3306/testing?useSSL=false
org.quartz.dataSource.development.user = testing
org.quartz.dataSource.development.password = nopass
org.quartz.dataSource.development.maxConnections = 10
org.quartz.dataSource.development.validationQuery = select 1

私を助けてくれる人はいますか?

私はgrails 3.2.3とクォーツプラグイン2.0.9を使用しています

4

1 に答える 1

5

私は最終的に自分で解決策を見つけました。Quartz プラグインのすべてのオプションは、それ自体で構成できますapplication.yml。サポートされているパラメーターのリストについては、http://www.quartz-scheduler.org/documentation/quartz-2.2.x/configuration/を参照してください。

これ以上のファイルは必要ありません。application.yml例として、私の抜粋を次に示します。

quartz:
  autoStartup: true
  jdbcStore: true
  scheduler:
    instanceName: 'staff_scheduler'
    instanceId: 'AUTO'
  threadPool:
    class: 'org.quartz.simpl.SimpleThreadPool'
    threadCount: 25
    threadPriority: 5
  jobStore:
    misfireThreshold: 60000
    class: 'org.quartz.impl.jdbcjobstore.JobStoreTX'
    driverDelegateClass: 'org.quartz.impl.jdbcjobstore.StdJDBCDelegate'
    useProperties: false
    dataSource: 'development'
    tablePrefix: 'Z_STAFF_SCHEDULER_'
    isClustered: true
    clusterCheckinInterval: 20000
  dataSource:
    development:
      driver: 'com.mysql.jdbc.Driver'
      URL: 'jdbc:mysql://localhost:3306/testing?useSSL=false'
      user: 'testing'
      password: 'nopass'
      maxConnections: 28
      validationQuery: 'select 1'
于 2016-12-26T14:08:17.330 に答える