【问题标题】:Tables not being created for quartz plugin with Grails 2.3.11未使用 Grails 2.3.11 为石英插件创建表
【发布时间】:2014-12-03 16:16:09
【问题描述】:

我正在尝试使用用于 grails 的石英插件 (http://grails.org/plugin/quartz) 启用作业持久性,但每次我尝试创建新作业时都找不到表。看起来插件没有创建表。

我在mysql中使用的数据库和我的grails版本是2.3.11。我尝试镜像此博客 (http://blog.robinpercy.com/2012/11/06/grails-clustered-quartz-configs-by-environment/) 中使用的配置,但未创建表。

这是我的石英配置:

jdbcProps = {
    scheduler.instanceName = "quartz"
    scheduler.instanceId = "AUTO"

    threadPool.class = "org.quartz.simpl.SimpleThreadPool"
    threadPool.threadCount = 3
    threadPool.threadPriority = 5

    jobStore.misfireThreshold = 60000

    jobStore.class = "org.quartz.impl.jdbcjobstore.JobStoreTX"
    jobStore.driverDelegateClass = "org.quartz.impl.jdbcjobstore.MSSQLDelegate"

    jobStore.useProperties = false
    jobStore.tablePrefix = "qrtz_"
    jobStore.isClustered = true
    jobStore.clusterCheckinInterval = 5000

    plugin.shutdownhook.class = "org.quartz.plugins.management.ShutdownHookPlugin"
    plugin.shutdownhook.cleanShutdown = true

}

environments {
development {
    quartz {
        autoStartup = true
        jdbcStore = true
        waitForJobsToCompleteOnShutdown = true
        props(jdbcProps)
    }
}
}

Quartz 可以找到我的 datasource.groovy 文件中指定的数据库,但找不到它需要的表。

dataSource {
        pooled = true
        driverClassName = "com.mysql.jdbc.Driver"
        username = "root"
        password = "root"
        dbCreate = "create-drop" // one of 'create', 'create-drop','update'
        url = "jdbc:mysql://localhost:3306/appDatabase?autoReconnect=true"
        properties {
            numTestsPerEvictionRun=3
            testOnBorrow=true
            testWhileIdle=true
            testOnReturn=true
            validationQuery="SELECT 1"
         }
    }

这里是例外

An error occurred while scanning for the next triggers to fire.
org.quartz.JobPersistenceException: Couldn't acquire next trigger: Table 'appDatabase.qrtz_TRIGGERS' doesn't exist [See nested exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'appDatabase.qrtz_TRIGGERS' doesn't exist

我在这里遗漏了什么吗?我需要手动创建表还是有一些配置错误?

【问题讨论】:

    标签: grails quartz-scheduler


    【解决方案1】:

    我已经有一段时间没有使用它了,但我怀疑它是否会为您创建表格。 Quartz 发行版为 docs/dbTables 目录中的 20 多个数据库提供 DDL,因此您可以将该文件用于您的数据库和版本,并在运行它们之前根据需要进行自定义。

    几年前我参加了一次会议演讲,其中包括集群 Quartz 并包括使用 Hibernate cfg.xml 和 hbm.xml 文件创建表的自动化方法。您可以 download the sample app 并使用相同的方法 - 它仍然可以与 Hibernate 3 一起使用,并且应该与 Hibernate 4 一起使用,但可能需要更新 xml 中的 <!DOCTYPE ...>

    【讨论】:

      猜你喜欢
      • 2015-03-30
      • 1970-01-01
      • 2012-11-22
      • 1970-01-01
      • 2011-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-07
      相关资源
      最近更新 更多