Quartz JDBCJobStore与MySQL有关 [英] Quartz JDBCJobStore problems with MySQL

查看:98
本文介绍了Quartz JDBCJobStore与MySQL有关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的spring mvc项目中通过job store使用Job persistence,但是我的数据库结构似乎有些错误。

I'm trying to use Job persistence via job store in my spring mvc project, but something seems wrong in my database structure.

我的数据库是MySQL(v 5.6.15)我在Quartz jar(v 1.8.6)中使用脚本创建了表。

My database is MySQL (v 5.6.15) and I created tables using scripts in Quartz jar (v 1.8.6).

执行一些测试我发现作业和触发器在DB中保持不变(和我希望)正确加载,但它们没有被执行。触发器状态始终为WAITING。

Executing some test I found that jobs and triggers are persisted in DB and (I hope) correctly loaded, but they aren't executed. Trigger status is always on "WAITING".

我尝试在SqlServer实例上创建表结构(总是使用提供的脚本),现在它可以正常工作!那么,MySql有什么问题?

I tried creating tables structure on a SqlServer instance (always using scripts provided) and, now it works!!! So, what's wrong with MySql?

我注意到的唯一区别是MySQL中的表名是小写的,而不是像SqlServer中的全部大写,这可能是个问题吗?

The only difference I notice is that table names in MySQL are lowercase, instead of all uppercase as in SqlServer, could it be a problem?

我的配置如下:

通过春季进行调度程序配置

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="quartzProperties">
        <map>
            <entry key="org.quartz.scheduler.instanceName" value="gep_scheduler" />
            <!-- ThreadPool -->
            <entry key="org.quartz.threadPool.class" value="org.quartz.simpl.SimpleThreadPool" />
            <entry key="org.quartz.threadPool.threadCount" value="3" />
            <entry
                key="org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread"
                value="true" />
            <!-- JobStore -->
            <entry key="org.quartz.jobStore.class" value="org.quartz.impl.jdbcjobstore.JobStoreTX" />
            <entry key="org.quartz.jobStore.driverDelegateClass" value="org.quartz.impl.jdbcjobstore.StdJDBCDelegate" />
            <entry key="org.quartz.jobStore.tablePrefix" value="qrtz_" />
            <entry key="org.quartz.jobStore.dataSource" value="qzDS" />
            <entry key="org.quartz.jobStore.isClustered" value="false" />
            <entry key="org.quartz.jobStore.misfireThreshold" value="60000" />
            <!-- DataSource -->
            <entry key="org.quartz.dataSource.qzDS.driver" value="${db.driver}" />
            <entry key="org.quartz.dataSource.qzDS.URL" value="${db.url}" />
            <entry key="org.quartz.dataSource.qzDS.user" value="${db.user}" />
            <entry key="org.quartz.dataSource.qzDS.password" value="${db.password}" />
            <entry key="org.quartz.dataSource.qzDS.maxConnections" value="${db.maxActivePools}" />
            </map>
    </property>
</bean>

注意不会抛出任何异常。

推荐答案

我终于从调度程序中发现了异常:

I finally caught an exception from the scheduler:


org.quartz.JobPersistenceException:无法获取下一个触发器:SQL语法中有错误;检查与MySQL服务器版本对应的手册,以便在第1行'OPTION SQL_SELECT_LIMIT = 5'附近使用正确的语法

问题出在MySQL驱动程序中。我使用的v5.1.6似乎与MySQL 5.6.x版本不兼容。

The problem was in MySQL driver. I was using v5.1.6 that seems not compatible with MySQL 5.6.x versions.

我解决了导入上一版本的 mysql-connector (目前为v5.1.31)。

I solved importing last version of mysql-connector (at the moment v5.1.31).

这篇关于Quartz JDBCJobStore与MySQL有关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆