Environment : Project is having org.quartz-scheduler.quartz:2.3.2 library which comes from org.springframework.boot:spring-boot-starter-quartz dependency.
ISSUE / Problem : QuartzConfig.class: Invocation of init method failed; nested exception is org.quartz.SchedulerException: DB URL not specified for DataSource: myDS
Goal : Goal is to have two seperate scheduler having separate configurations and seperate HikariCP DB connection pool.
I have this following quartz2.properties :
# Configure the Quartz Scheduler
# Configure the HikariCP DataSource
org.quartz.datasource.myDS.URL=jdbc:postgresql://localhost:5442/reports
org.quartz.datasource.myDS.jdbcUrl=${spring.datasource.url}
org.quartz.datasource.myDS.driver-class-name=org.postgresql.Driver
org.quartz.dataSource.myDS.driver=org.postgresql.Driver
org.quartz.datasource.myDS.username=app
org.quartz.datasource.myDS.password=app
org.quartz.datasource.myDS.hikari.maximum-pool-size=10
org.quartz.datasource.myDS.hikari.connection-test-query=SELECT 1
org.quartz.dataSource.myDS.provider = hikaricp
org.quartz.dataSource.myDS.maxConnections = 10
spring.datasource.myDS.URL=${spring.datasource.url}
#org.quartz.dataSource.myDS.driver = com.mysql.jdbc.Driver
# Configure the ThreadPool for Quartz
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.threadPriority = 9
# Configure the JobStore
org.quartz.scheduler.instanceName=nightly-quartz-scheduler
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
spring.quartz.properties.org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.scheduler.instanceId=AUTO
org.quartz.scheduler.idleWaitTime=5000
org.quartz.plugin.triggHistory.class=org.quartz.plugins.history.LoggingTriggerHistoryPlugin
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
org.quartz.jobStore.useProperties=true
org.quartz.jobStore.misfireThreshold=60000
org.quartz.jobStore.tablePrefix=quartz.QRTZ_NIGHTLY_
org.quartz.jobStore.isClustered=true
org.quartz.jobStore.clusterCheckinInterval=20000
org.quartz.jobStore.dataSource = myDS
Spring boot application startup fails with the exception : SchedulerException: DB URL not specified for DataSource
o.s.b.f.BeanCreationException: Error creating bean with name 'myBean' defined in class path resource [./config/QuartzConfig.class]: Invocation of init method failed; nested exception is org.quartz.SchedulerException: DB URL not specified for DataSource: myDS
at o.s.b.f.s.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.26.jar:5.3.26]
at o.s.b.f.s.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)\n\tat o.s.b.f.s.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at o.s.b.f.s.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at o.s.b.f.s.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at o.s.b.f.s.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at o.s.b.f.s.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at o.s.b.f.c.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at o.s.b.f.s.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
at o.s.b.f.s.DefaultListableBeanFactory.resolveDe...
Also I have the following configuration in application.properties :
spring.datasource.url=jdbc:postgresql://localhost:5442/reports
spring.datasource.jdbcUrl=${spring.datasource.url}
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.username=reporting_app
spring.datasource.password=reporting_app
spring.datasource.hikari.maximum-pool-size=10
spring.datasource.hikari.connection-test-query=SELECT 1
Followed the steps mentioned here also : http://www.quartz-scheduler.org/documentation/quartz-2.3.0/configuration/ConfigDataSources.html
Comment From: wilkinsona
Thanks for the report. Unfortunately, with only an incomplete stack trace, partial configuration, and no explanation of why you believe this is a Spring Boot problem, there's very little we can do. If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Comment From: Mudassir-23
I faced a similar issue when I had not included the c3p0 dependency.
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
Comment From: YashwinVincilium
@Mudassir-23 Thanks it helped ! and also in my case I have to add this property for it to work spring.quartz.properties.org.quartz.jobStore.class=org.springframework.scheduling.quartz.LocalDataSourceJobStore