NutzCN Logo
问答 使用postgresql的时候,遇到的问题。
发布于 2539天前 作者 hexy1989 5482 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

由于业务需要,我把这个项目默认的mysql改为了postgresql,其它一切正常,就是定时任务一直有错误。
当我启用的时候:

[DEBUG] 2018-01-09 14:59:43,094 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [POST] path=/platform/sys/task/enable/63d16c4ca60e45f29e7ca9552ff310a8 : SysTaskController.enable(SysTaskController.java:175)
[DEBUG] 2018-01-09 14:59:43,094 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:164) - Get 'shiroUtil'<class cn.wizzer.framework.util.ShiroUtil>
[DEBUG] 2018-01-09 14:59:43,095 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:164) - Get 'dateUtil'<class cn.wizzer.framework.util.DateUtil>
[DEBUG] 2018-01-09 14:59:43,095 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:164) - Get 'stringUtil'<class cn.wizzer.framework.util.StringUtil>
[DEBUG] 2018-01-09 14:59:43,095 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:164) - Get 'sysTaskController'<class cn.wizzer.app.web.modules.controllers.platform.sys.SysTaskController>
[DEBUG] 2018-01-09 14:59:43,100 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM sys_task  WHERE id=?
    |                                1 |
    |----------------------------------|
    | 63d16c4ca60e45f29e7ca9552ff310a8 |
  For example:> "SELECT * FROM sys_task  WHERE id='63d16c4ca60e45f29e7ca9552ff310a8'"
[DEBUG] 2018-01-09 14:59:43,133 org.quartz.impl.jdbcjobstore.DBSemaphore.obtainLock(DBSemaphore.java:107) - Lock 'TRIGGER_ACCESS' is desired by: http-apr-8080-exec-7
[DEBUG] 2018-01-09 14:59:43,134 org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:92) - Lock 'TRIGGER_ACCESS' is being obtained: http-apr-8080-exec-7
[DEBUG] 2018-01-09 14:59:43,135 org.quartz.impl.jdbcjobstore.DBSemaphore.obtainLock(DBSemaphore.java:116) - Lock 'TRIGGER_ACCESS' given to: http-apr-8080-exec-7
[DEBUG] 2018-01-09 14:59:43,183 org.quartz.impl.jdbcjobstore.DBSemaphore.releaseLock(DBSemaphore.java:141) - Lock 'TRIGGER_ACCESS' returned by: http-apr-8080-exec-7
[DEBUG] 2018-01-09 14:59:43,185 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - UPDATE sys_task SET disabled=?  WHERE id=?
    |     1 |                                2 |
    |-------|----------------------------------|
    | false | 63d16c4ca60e45f29e7ca9552ff310a8 |
  For example:> "UPDATE sys_task SET disabled=false  WHERE id='63d16c4ca60e45f29e7ca9552ff310a8'"
[DEBUG] 2018-01-09 14:59:43,192 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:164) - Get 'sLogService'<class cn.wizzer.app.web.commons.slog.SLogService>
[DEBUG] 2018-01-09 14:59:43,192 cn.wizzer.app.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) - [POST]URI=/platform/sys/task/enable/63d16c4ca60e45f29e7ca9552ff310a8 98ms
[DEBUG] 2018-01-09 14:59:43,194 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - INSERT INTO sys_log_201801(username,type,tag,src,ip,msg,param,result,opBy,opAt,delFlag) VALUES(?,?,?,?,?,?,?,?,?,?,?) 
    |     1 |        2 |    3 |                                                                           4 |         5 |        6 | 7 | 8 |                                9 |         10 |    11 |
    |-------|----------|------|-----------------------------------------------------------------------------|-----------|----------|--|--|----------------------------------|------------|-------|
    | 超级管理员 | platform | 启用任务 | cn.wizzer.app.web.modules.controllers.platform.sys.SysTaskController#enable | 127.0.0.1 | 任务名:测试任务 |  |  | f32f1b279ea0410bbadccbdb98dfd360 | 1515481183 | false |
  For example:> "INSERT INTO sys_log_201801(username,type,tag,src,ip,msg,param,result,opBy,opAt,delFlag) VALUES('超级管理员','platform','启用任务','cn.wizzer.app.web.modules.controllers.platform.sys.SysTaskController#enable','127.0.0.1','任务名:测试任务','','','f32f1b279ea0410bbadccbdb98dfd360',1515481183,false) "
[ERROR] 2018-01-09 14:59:43,207 org.quartz.core.ErrorLogger.schedulerError(QuartzScheduler.java:2425) - An error occurred while scanning for the next triggers to fire.
org.quartz.JobPersistenceException: Couldn't acquire next trigger: Couldn't retrieve trigger: 不良的类型值 long : \x [See nested exception: org.quartz.JobPersistenceException: Couldn't retrieve trigger: 不良的类型值 long : \x [See nested exception: org.postgresql.util.PSQLException: 不良的类型值 long : \x]]
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2864)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport$40.execute(JobStoreSupport.java:2759)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport$40.execute(JobStoreSupport.java:2757)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3803)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2756)
	at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:272)
Caused by: org.quartz.JobPersistenceException: Couldn't retrieve trigger: 不良的类型值 long : \x [See nested exception: org.postgresql.util.PSQLException: 不良的类型值 long : \x]
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1533)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2808)
	... 5 more
Caused by: org.postgresql.util.PSQLException: 不良的类型值 long : \x
	at org.postgresql.jdbc.PgResultSet.toLong(PgResultSet.java:2849)
	at org.postgresql.jdbc.PgResultSet.getLong(PgResultSet.java:2071)
	at org.postgresql.jdbc.PgResultSet.getBlob(PgResultSet.java:424)
	at org.postgresql.jdbc.PgResultSet.getBlob(PgResultSet.java:411)
	at com.alibaba.druid.pool.DruidPooledResultSet.getBlob(DruidPooledResultSet.java:1170)
	at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.getObjectFromBlob(StdJDBCDelegate.java:3190)
	at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTrigger(StdJDBCDelegate.java:1780)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1531)
	... 6 more
[DEBUG] 2018-01-09 14:59:57,488 org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3877) - ClusterManager: Check-in complete.
[DEBUG] 2018-01-09 15:00:17,488 org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3877) - ClusterManager: Check-in complete.
[DEBUG] 2018-01-09 15:00:37,490 org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3877) - ClusterManager: Check-in complete.
[DEBUG] 2018-01-09 15:00:57,492 org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3877) - ClusterManager: Check-in complete.
[DEBUG] 2018-01-09 15:01:17,494 org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3877) - ClusterManager: Check-in complete.
[DEBUG] 2018-01-09 15:01:17,498 org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:3949) - MisfireHandler: scanning for misfires...
[DEBUG] 2018-01-09 15:01:17,501 org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3198) - Found 0 triggers that missed their scheduled fire-time.

禁用任务的时候,又报这个错误:

[DEBUG] 2018-01-09 15:01:48,450 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [POST] path=/platform/sys/task/disable/63d16c4ca60e45f29e7ca9552ff310a8 : SysTaskController.disable(SysTaskController.java:205)
[DEBUG] 2018-01-09 15:01:48,451 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:164) - Get 'shiroUtil'<class cn.wizzer.framework.util.ShiroUtil>
[DEBUG] 2018-01-09 15:01:48,451 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:164) - Get 'dateUtil'<class cn.wizzer.framework.util.DateUtil>
[DEBUG] 2018-01-09 15:01:48,451 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:164) - Get 'stringUtil'<class cn.wizzer.framework.util.StringUtil>
[DEBUG] 2018-01-09 15:01:48,452 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:164) - Get 'sysTaskController'<class cn.wizzer.app.web.modules.controllers.platform.sys.SysTaskController>
[DEBUG] 2018-01-09 15:01:48,456 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM sys_task  WHERE id=?
    |                                1 |
    |----------------------------------|
    | 63d16c4ca60e45f29e7ca9552ff310a8 |
  For example:> "SELECT * FROM sys_task  WHERE id='63d16c4ca60e45f29e7ca9552ff310a8'"
[ERROR] 2018-01-09 15:01:48,484 cn.wizzer.app.web.modules.controllers.platform.sys.SysTaskController.disable(SysTaskController.java:215) - org.quartz.JobPersistenceException: Couldn't obtain triggers for job: Cannot convert the column of type BYTEA to requested type long. [See nested exception: org.postgresql.util.PSQLException: Cannot convert the column of type BYTEA to requested type long.]
[DEBUG] 2018-01-09 15:01:48,485 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - UPDATE sys_task SET disabled=?  WHERE id=?
    |    1 |                                2 |
    |------|----------------------------------|
    | true | 63d16c4ca60e45f29e7ca9552ff310a8 |
  For example:> "UPDATE sys_task SET disabled=true  WHERE id='63d16c4ca60e45f29e7ca9552ff310a8'"
[DEBUG] 2018-01-09 15:01:48,491 cn.wizzer.app.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) - [POST]URI=/platform/sys/task/disable/63d16c4ca60e45f29e7ca9552ff310a8 40ms
[DEBUG] 2018-01-09 15:01:48,492 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - INSERT INTO sys_log_201801(username,type,tag,src,ip,msg,param,result,opBy,opAt,delFlag) VALUES(?,?,?,?,?,?,?,?,?,?,?) 
    |     1 |        2 |    3 |                                                                            4 |         5 |        6 | 7 | 8 |                                9 |         10 |    11 |
    |-------|----------|------|------------------------------------------------------------------------------|-----------|----------|--|--|----------------------------------|------------|-------|
    | 超级管理员 | platform | 禁用任务 | cn.wizzer.app.web.modules.controllers.platform.sys.SysTaskController#disable | 127.0.0.1 | 任务名:测试任务 |  |  | f32f1b279ea0410bbadccbdb98dfd360 | 1515481308 | false |
  For example:> "INSERT INTO sys_log_201801(username,type,tag,src,ip,msg,param,result,opBy,opAt,delFlag) VALUES('超级管理员','platform','禁用任务','cn.wizzer.app.web.modules.controllers.platform.sys.SysTaskController#disable','127.0.0.1','任务名:测试任务','','','f32f1b279ea0410bbadccbdb98dfd360',1515481308,false) "

目前没有找到具体的错误地方,还请各位提点一下。

2 回复

http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-09.html

按文档里面的描述, 应该是需要设置

org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate

我晕,还真的是。我都看到这个东西了,没仔细看。谢谢!下次注意。

添加回复
请先登陆
回到顶部