含溪涤心 2013-08-23 15:50
浏览 595
已采纳

quartz2.1.5 调用 scheduler.start()方法时报异常

quartz2.1.5 调用 scheduler.start()方法时报这样一个异常:
严重: An error occurred while scanning for the next triggers to fire.
org.quartz.JobPersistenceException: Couldn't acquire next trigger: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=1' at line 1 [See nested exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=1' at line 1]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2840)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$41.execute(JobStoreSupport.java:2755)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3811)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2751)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:264)
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=1' at line 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3170)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3099)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1248)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTriggerToAcquire(StdJDBCDelegate.java:2571)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2781)
... 4 more

我数据库用的是mysql,quartz.properties配置文件时这样的:
org.quartz.scheduler.instanceName: SchedulerName
#是否支持远程管理 false:不支持 (服务端)
org.quartz.scheduler.rmi.export: false
#是否支持远程代理 false:不支持 (客服端)
org.quartz.scheduler.rmi.proxy: false
#如果你要 Quartz 在调用你的 Job 的 execute 之前启动一个 UserTransaction 的话,设置这个属性为 true 。
#这个事物将在 Job 的 execute 方法完成和 JobDataMap (假如是一个 StatefulJob ) 更新后提交。默认值为 false 。
org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
#默认线程池类
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
#最多只能有50个线程并发

org.quartz.threadPool.threadCount: 50
#线程优先级别
org.quartz.threadPool.threadPriority: 5
#指定由石英产生的线程将继承范围内的初始化线程的ClassLoader(线程初始化石英实例)。
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
#线程之间错开后允许间隔时间 毫秒为单位 如果超过这个时间 下一个线程不执行 反之 执行
org.quartz.jobStore.misfireThreshold: 60000
##所有的Quartz数据,例如Job和Trigger的细节信息被存储在内存中。 数据库:org.quartz.impl.jdbcjobstore.JobStoreTX:内存:org.quartz.simpl.RAMJobStore
org.quartz.jobStore.class: org.quartz.impl.jdbcjobstore.JobStoreTX
#根据选择的数据库类型不同而不同 PostgreSQLDelegate(mysql)
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate
#org.quartz.jobStore.dataSource = myDS
#org.quartz.jobStore.isClustered = false
#org.quartz.jobStore.useProperties = true
org.quartz.jobStore.tablePrefix = QRTZ_
#isClustered设置为"true"激活集群特性
org.quartz.jobStore.isClustered = false
org.quartz.jobStore.maxMisfiresToHandleAtATime=1

请问大神,这是什么原因啊?百度了好久,都没找到具体原因

  • 写回答

1条回答 默认 最新

  • _1_1_7_ 2013-08-23 16:06
    关注

    OPTION SQL_SELECT_LIMIT=1
    改为
    SET SQL_SELECT_LIMIT=1;
    [url]http://forums.terracotta.org/forums/posts/list/8001.page[/url]

    还有一种说法是mysql的bug,可以升级jdbc驱动
    [quote]This is a common pb with MySQL 5.6 ; just update the jar jdbc connector :

    • download from this place : http://www.mysql.com/downloads/connector/j/
    • and extract the "mysql-connector-java-5.X.XX-bin.jar" from the zip
    • go to the gateway configuration page and edit the driver (database>drivers)[/quote]

    [url]http://www.inductiveautomation.com/forum/viewtopic.php?f=72&p=35017[/url]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式