环境centos6.7,部署应用后启动tomcat发现日志报错,如下:Invocation of init method failed; nested exception is org.quartz.JobPersistenceException: Couldn't retrieve trigger: Table 'nntest.qrtz_TRIGGERS' doesn't exist [See nested exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'nntest.qrtz_TRIGGERS' doesn't exist]
连接mysql查看qrtz_TRIGGERS存在;那么则需要去查看下mysql 的配置文件里是否设置了不区分大小写,vim /etc/my.cnf
在 [mysqld] 模块中添加:
lower_case_table_names=1
保存重启mysql
其实准确来说不是说 Linux 对于 MySQL 表名忽略大小写,而是应用上面的配置后,MySQL 服务程序会来自于应用程序里的请求的表名转换为小写,如你查询 select* UNMI_TABLE,MySQL 会认为是查询的 select * from unmi_table,所以在加入 lower_case_table_names=1 之前时你必须把表名都改为小写。也就是在创建表时都用小写名字,如果创建的表名为 UNMI_TABLE,那么程序中无论是执行 select * from UNMI_TABLE 还是执行 select * from unmi_table 都会碰到类似下面的错误: Invocation of init method failed; nested exception is org.quartz.JobPersistenceException: Couldn't retrieve trigger: Table 'unmijob.qrtz_triggers' doesn't exist [See nested exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'unmijob.qrtz_triggers' doesn't exist] 因为 MySQL 服务程序认为表名就是小写的 unmi_table,而在数据库中的表名不是这样子的。 而且此时在 MySQL 客户端都无法把 QRTZ_TRIGGERS 改成 qrtz_triggers. 因为表名的大小写是与文件系统中的数据目录下的 frm 文件相对应的。
|