說明:在使用Tomcat6.0.32+Spring3.05+Quartz1.8.6+Mysql5.5.9 此項目在我本機上沒有問題,當我把mysql 腳本導入到服務器上,將數據源配置修改為服務器對應的mysql時,再次運行程序出現以下問題,
錯誤信息如下:
嚴重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduler' defined in ServletContext resource [/WEB-INF/spring-conf.xml]: Invocation of init method failed; nested exception is org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Table 'wzhpush2.qrtz_LOCKS' doesn't exist [See nested exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'wzhpush2.qrtz_LOCKS' doesn't exist]]
明明我的表都是存在的,卻提示:Table 'wzhpush2.qrtz_LOCKS' doesn't exist。
最后找到原因是:我本地是Window平台,此平台下面Mysql默認是不區分下小寫的,而服務器時Linux平台,在linux平台下面Mysql默認是嚴格區分大小寫的。此時,修改Mysql配置文件讓其不區分大小寫,問題解決。。
>sudo vim /etc/mysql/my.cnf
在[mysqld]下面添加:
lower_case_table_names = 1
然后保存退出,重啟Mysql
>sudo restart mysql