I am able to create a quartz job in spring but that is about the only thing I can do. The job does not fire and I can check that the job exists but am unable to retrieve it.
I am using springboot 2.6.6. My configuration looks like this:
spring:
################################
# application properties
################################
application:
name: job-manager
################################
# postgress database
################################
datasource:
url: ${db.url}
username: ${db.username}
password: ${db.password}
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
ddl-auto: validate
#format_sql: true
show-sql: true
################################
# Quartz configuration
################################
quartz:
auto-startup: false
job-store-type: jdbc
wait-for-jobs-to-complete-on-shutdown: true
jdbc.initialize-schema: never
properties:
org.quartz.threadPool.threadCount: 5 # each thread runs a concurrent job
org:
quartz:
jobStore.driverDelegateClass: org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
I am able to create a new job and its trigger but the trigger never fires. I can also execute the following without any problem and it returns true:
scheduler.checkExists(new JobKey(jobName, jobGroupName));
The above snippet returns true. However when I try to execute
jobDetail = scheduler.getJobDetail(new JobKey(jobName, jobGroupName));
I get the following error:
org.quartz.JobPersistenceException: Couldn't retrieve job: Bad value for type long : \xaced0005737200156f72672e71756172747a2e4a6f62446174614d61709fb083e8bfa9b0cb020000787200266f72672e71756172747a2e7574696c732e537472696e674b65794469727479466c61674d61708208e8c3fbc55d280200015a0013616c6c6f77735472616e7369656e74446174617872001d6f72672e71756172747a2e7574696c732e4469727479466c61674d617013e62ead28760ace0200025a000564697274794c00036d617074000f4c6a6176612f7574696c2f4d61703b787000737200116a6176612e7574696c2e486173684d61700507dac1c31660d103000246000a6c6f6164466163746f724900097468726573686f6c6478703f40000000000010770800000010000000007800
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveJob(JobStoreSupport.java:1401) ~[quartz-2.3.2.jar:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport$9.execute(JobStoreSupport.java:1382) ~[quartz-2.3.2.jar:na]
The nested exception is
Caused by: org.postgresql.util.PSQLException: Bad value for type long : \xaced0005737200156f72672e71756172747a2e4a6f62446174614d61709fb083e8bfa9b0cb020000787200266f72672e71756172747a2e7574696c732e537472696e674b65794469727479466c61674d61708208e8c3fbc55d280200015a0013616c6c6f77735472616e7369656e74446174617872001d6f72672e71756172747a2e7574696c732e4469727479466c61674d617013e62ead28760ace0200025a000564697274794c00036d617074000f4c6a6176612f7574696c2f4d61703b787000737200116a6176612e7574696c2e486173684d61700507dac1c31660d103000246000a6c6f6164466163746f724900097468726573686f6c6478703f40000000000010770800000010000000007800
Any ideas. I have found one similar post without an answer. Any help would be appreciated.
CodePudding user response:
The issue is configuration 'org.quartz.jobStore.driverDelegateClass' is not correctly picking up 'org.quartz.impl.jdbcjobstore.PostgreSQLDelegate'.
As per your exception, Delegate class is still the default implementation of 'org.quartz.impl.jdbcjobstore.StdJDBCDelegate'
There seems to be error with yaml configuration, refer here : Spring Boot Quartz Scheduler Configuration
