当前位置:编程学习 > JAVA >>

求指教

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

请问大神,这是什么原因啊?百度了好久,都没找到具体原因 quartz   数据库 --------------------编程问答-------------------- 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' 

语法错误, 检查下你MySql的版本,是否支持'OPTION SQL_SELECT_LIMIT=1'  --------------------编程问答-------------------- 从报错处看,可能是你的SQL语句有问题或者你的MySQL版本有问题 --------------------编程问答-------------------- 你有一个错误在您的SQL语法
在 'OPTION SQL_SELECT_LIMIT=1'  附近。。。

检查一下

补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,