2014-11-03 58 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 ...>