Quartz properties file pass in environment variables

I'm trying to add environment variables to my quartz properties file, but it's not being loaded properly.

Heres my quartz.properties

  org.quartz.scheduler.instanceName: scheduler
  org.quartz.scheduler.instanceId: AUTO
  org.quartz.scheduler.skipUpdateCheck: true
  org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
  org.quartz.threadPool.threadCount: 10
  org.quartz.threadPool.threadPriority: 5
  org.quartz.jobStore.misfireThreshold: 60000
  org.quartz.jobStore.class: org.quartz.impl.jdbcjobstore.JobStoreTX
  org.quartz.jobStore.driverDelegateClass: org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
  org.quartz.jobStore.useProperties: false
  org.quartz.jobStore.dataSource: myDS
  org.quartz.jobStore.tablePrefix: QRTZ_
  org.quartz.jobStore.isClustered: true
  org.quartz.dataSource.myDS.driver: org.postgresql.Driver
  org.quartz.dataSource.myDS.URL: ${APP_JDBC_URL:-jdbc:postgresql://localhost:5432/db}
  org.quartz.dataSource.myDS.user:  ${APP_JDBC_USER:-user}
  org.quartz.dataSource.myDS.password: ${APP_JDBC_PASSWORD:-pass}
  org.quartz.dataSource.myDS.maxConnections: 5
  org.quartz.dataSource.myDS.validationQuery: select 1

Exception:

ERROR [2018-03-13 21:11:13,958] org.quartz.impl.jdbcjobstore.JobStoreTX: ClusterManager: Error managing cluster: Failed to obtain DB connection from data source 'myDS': java.sql.SQLException: Connections could not be acquired from the underlying database!
! com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
! at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)
! at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
! at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
! at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
! ... 26 common frames omitted

1 answer

  • answered 2018-03-13 21:18 Ferenc Pomeisl

    please do not use hyphen

    org.quartz.dataSource.myDS.URL:${APP_JDBC_URL:jdbc:postgresql://localhost:5432/db} org.quartz.dataSource.myDS.user:${APP_JDBC_USER:user} org.quartz.dataSource.myDS.password:${APP_JDBC_PASSWORD:pass}

    for example is my configuration that works: adb.datasource.url=${DB1_URL:jdbc:sqlserver://127.0.0.1:1433;databaseName=authdb}