2016-10-26 22 views
0

我將Quartz配置爲使用數據庫中的預定作業。 現在,當我開始調度器:從失火中恢復的數據庫錯誤Qualtz

try { 
      // Grab the Scheduler instance from the Factory 
      Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler(); 


      // and start it off 
      scheduler.start(); 

      scheduler.shutdown(); 

     } catch (Exception se) { 
      Log.log(LogLevel.ERROR, se.getMessage()); 
     } 

該項目的配置文件是這樣的:

org.quartz.scheduler.instanceName = DatabaseScheduler 
org.quartz.scheduler.skipUpdateCheck = true 
org.quartz.threadPool.threadCount = 3 

org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX 
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.MSSQLDelegate 
org.quartz.dataSource.myDB.driver = com.microsoft.sqlserver.jdbc.SQLServerDriver 
org.quartz.dataSource.myDB.URL = jdbc:sqlserver://server:1433;databaseName=schedules 
org.quartz.dataSource.myDB.user = sa  
org.quartz.dataSource.myDB.password = password 
org.quartz.dataSource.myDB.maxConnections = 2 

org.quartz.jobStore.tablePrefix = QRTZ_ 
org.quartz.jobStore.dataSource = myDB 
org.quartz.scheduler.misfirePolicy = doNothing 

,我得到的錯誤是:

org.quartz.JobPersistenceException: Database error recovering from misfires. [See nested exception: java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.InterruptedException] 
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3213) 
    at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:3951) 
    at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:3972) 
Caused by: java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.InterruptedException 
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106) 
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65) 
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:62) 
    at com.mchange.v2.c3p0.stmt.GooGooStatementCache.acquireStatement(GooGooStatementCache.java:562) 
    at com.mchange.v2.c3p0.stmt.GooGooStatementCache.checkoutStatement(GooGooStatementCache.java:168) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.checkoutStatement(NewPooledConnection.java:234) 
    at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:199) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHandler.invoke(AttributeRestoringConnectionInvocationHandler.java:73) 
    at com.sun.proxy.$Proxy3.prepareStatement(Unknown Source) 
    at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.countMisfiredTriggersInState(StdJDBCDelegate.java:390) 
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3192) 
    ... 2 more 

有人可以幫助我有這個錯誤?我也看了一下計算器post。沒有任何運氣。我正在使用Quartz 2.2.3。即使當我的數據庫表是空的,我得到了錯誤。

回答

0

發現此問題。在我的源代碼中,調度程序啓動並立即關閉調度程序。在這段時間內,沒有任何事情可以安排,並且調度程序的開始在調用結束之前還沒有完成。刪除關閉調用它正常工作。