2014-11-03 39 views
1

我试图使用石英插件grails(http://grails.org/plugin/quartz)启用作业持久性,但每次尝试创建新作业时都无法找到表。它看起来像插件不创建表。没有为Grails 2.3.11创建石英插件表

我在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) 
    } 
} 
} 

石英可以找到自己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 

我在这里失去了一些东西?我需要手动创建表还是有一些配置错误?

回答

3

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

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