Reputation: 3121
The application I am supporting uses Quartz Scheduler version 2.3.2 with Oracle database.
User and password credentials are specified in Quartz configuration datasource section of the properties file.
Here is the config properties file which works well:
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool,
org.quartz.threadPool.threadCount=5,
org.quartz.threadPool.threadPriority=4,
org.quartz.jobStore.misfireThreshold=36000000,
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX,
org.quartz.jobStore.tablePrefix=QRTZ_,
org.quartz.scheduler.instanceId=AUTO,
org.quartz.jobStore.isClustered=true,
org.quartz.jobStore.clusterCheckinInterval=1800000,
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate,
org.quartz.jobStore.dataSource=qzDS,
org.quartz.dataSource.qzDS.driver=oracle.jdbc.OracleDriver,
org.quartz.dataSource.qzDS.driver.oracle.jdbc.ReadTimeout=15000,
org.quartz.dataSource.qzDS.driver.oracle.net.CONNECT_TIMEOUT=15000,
org.quartz.dataSource.qzDS.URL=jdbc:oracle:thin:@MYQUARTZAPP,
org.quartz.dataSource.qzDS.user=myquartzapp,
org.quartz.dataSource.qzDS.password=myquartzapp,
org.quartz.dataSource.qzDS.maxConnections=10,
org.quartz.scheduler.skipUpdateCheck=true,
I have managed to make Oracle wallet work with a custom database.
This avoids from having plain text password specified in the configuration.
Using a pair of encrypted files, cwallet.sso
& ewallet.p12
, generated with Oracle tool mkstore
.
And specifying its location path in oracle.net.wallet_location
system (-D
) or in connection properties.
Unfortunately, I am not able to make it work with Quartz Scheduler.
So when adding wallet files and location and removing user & password from quartz config, returns:
java.sql.SQLException: ORA-01017: invalid username/password; logon denied
Debugging Quartz initialization, it seems that C3P0PooledConnectionPoolManager
gets empty user and password, and is not really using Oracle wallet indications, so it fails to logon. Here the logs and exception thrown:
2020-01-19 11:11:18,562 main INFO [o.q.i.StdSchedulerFactory:1036] instantiate | Using ConnectionProvider class 'org.quartz.utils.C3p0PoolingConnectionProvider' for data source 'qzDS'
2020-01-19 11:11:18,816 MLog-Init-Reporter INFO [c.m.v.l.MLog:212] log | MLog clients using slf4j logging.
2020-01-19 11:11:18,822 MLog-Init-Reporter DEBUG [c.m.v.l.MLog:207] log | Reading VM config for path list /com/mchange/v2/log/default-mchange-log.properties, /mchange-commons.properties, /c3p0.properties, hocon:/reference,/application,/c3p0,/, /mchange-log.properties, /
2020-01-19 11:11:18,822 MLog-Init-Reporter DEBUG [c.m.v.l.MLog:207] log | The configuration file for resource identifier '/mchange-commons.properties' could not be found. Skipping.
2020-01-19 11:11:18,822 MLog-Init-Reporter DEBUG [c.m.v.l.MLog:207] log | The configuration file for resource identifier '/c3p0.properties' could not be found. Skipping.
2020-01-19 11:11:18,822 MLog-Init-Reporter DEBUG [c.m.v.l.MLog:207] log | The configuration file for resource identifier 'hocon:/reference,/application,/c3p0,/' could not be found. Skipping.
2020-01-19 11:11:18,822 MLog-Init-Reporter DEBUG [c.m.v.l.MLog:207] log | The configuration file for resource identifier '/mchange-log.properties' could not be found. Skipping.
2020-01-19 11:11:18,915 main DEBUG [c.m.v.c.MConfig:207] log | The configuration file for resource identifier '/mchange-commons.properties' could not be found. Skipping.
2020-01-19 11:11:18,916 main DEBUG [c.m.v.c.MConfig:207] log | The configuration file for resource identifier '/mchange-log.properties' could not be found. Skipping.
2020-01-19 11:11:18,917 main DEBUG [c.m.v.c.MConfig:207] log | The configuration file for resource identifier 'hocon:/reference,/application,/c3p0,/' could not be found. Skipping.
2020-01-19 11:11:18,918 main DEBUG [c.m.v.c.MConfig:207] log | The configuration file for resource identifier '/c3p0.properties' could not be found. Skipping.
2020-01-19 11:11:19,418 main INFO [c.m.v.c.C3P0Registry:212] log | Initializing c3p0-0.9.5.4 [built 23-March-2019 23:00:48 -0700; debug? true; trace: 10]
2020-01-19 11:11:20,089 main DEBUG [c.m.v.c.m.DynamicPooledDataSourceManagerMBean:204] log | MBean: com.mchange.v2.c3p0:type=PooledDataSource,identityToken=1hgec1aa71gkv1fm1n5rn52|58feb6b0,name=1hgec1aa71gkv1fm1n5rn52|58feb6b0 registered.
2020-01-19 11:11:20,503 main DEBUG [c.m.v.c.m.DynamicPooledDataSourceManagerMBean:204] log | MBean: com.mchange.v2.c3p0:type=PooledDataSource,identityToken=1hgec1aa71gkv1fm1n5rn52|58feb6b0,name=1hgec1aa71gkv1fm1n5rn52|58feb6b0 unregistered, in order to be reregistered after update.
2020-01-19 11:11:20,504 main DEBUG [c.m.v.c.m.DynamicPooledDataSourceManagerMBean:204] log | MBean: com.mchange.v2.c3p0:type=PooledDataSource,identityToken=1hgec1aa71gkv1fm1n5rn52|58feb6b0,name=1hgec1aa71gkv1fm1n5rn52|58feb6b0 registered.
2020-01-19 11:11:20,879 main INFO [o.q.i.StdSchedulerFactory:1220] instantiate | Using default implementation for ThreadExecutor
2020-01-19 11:11:21,073 main INFO [o.q.c.SchedulerSignalerImpl:61] <init> | Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2020-01-19 11:11:21,075 main INFO [o.q.c.QuartzScheduler:229] <init> | Quartz Scheduler v.2.3.2 created.
2020-01-19 11:11:21,092 main INFO [o.q.i.j.JobStoreTX:672] initialize | Using db table-based data access locking (synchronization).
2020-01-19 11:11:21,130 main INFO [o.q.i.j.JobStoreTX:59] initialize | JobStoreTX initialized.
2020-01-19 11:11:21,139 main INFO [o.q.c.QuartzScheduler:294] initialize | Scheduler meta-data: Quartz Scheduler (v2.3.2) 'QuartzScheduler' with instanceId 'sm2m-core1579432280918'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 5 threads.
Using job-store 'org.quartz.impl.jdbcjobstore.JobStoreTX' - which supports persistence. and is clustered.
2020-01-19 11:11:21,140 main INFO [o.q.i.StdSchedulerFactory:1374] instantiate | Quartz scheduler 'QuartzScheduler' initialized from an externally provided properties instance.
2020-01-19 11:11:21,142 main INFO [o.q.i.StdSchedulerFactory:1378] instantiate | Quartz scheduler version: 2.3.2
2020-01-19 11:14:47,061 main INFO [c.m.v.c.i.AbstractPoolBackedDataSource:212] log | Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 1hgec1aa71gkv1fm1n5rn52|58feb6b0, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> oracle.jdbc.OracleDriver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hgec1aa71gkv1fm1n5rn52|58feb6b0, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:oracle:thin:@MYQUARTZAPP, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 10, maxStatements -> 0, maxStatementsPerConnection -> 120, minPoolSize -> 1, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
2020-01-19 11:14:47,281 main DEBUG [c.m.v.c.MConfig:207] log | The configuration file for resource identifier '/mchange-commons.properties' could not be found. Skipping.
2020-01-19 11:14:47,282 main DEBUG [c.m.v.c.MConfig:207] log | The configuration file for resource identifier '/mchange-log.properties' could not be found. Skipping.
2020-01-19 11:14:47,283 main DEBUG [c.m.v.c.MConfig:207] log | The configuration file for resource identifier '/c3p0.properties' could not be found. Skipping.
2020-01-19 11:14:47,284 main DEBUG [c.m.v.c.MConfig:207] log | The configuration file for resource identifier 'hocon:/reference,/application,/c3p0,/' could not be found. Skipping.
2020-01-19 11:14:47,294 main DEBUG [c.m.v.r.BasicResourcePool:204] log | com.mchange.v2.resourcepool.BasicResourcePool@747f6c5a config: [start -> 3; min -> 1; max -> 10; inc -> 3; num_acq_attempts -> 30; acq_attempt_delay -> 1000; check_idle_resources_delay -> 0; max_resource_age -> 0; max_idle_time -> 0; excess_max_idle_time -> 0; destroy_unreturned_resc_time -> 0; expiration_enforcement_delay -> 0; break_on_acquisition_failure -> false; debug_store_checkout_exceptions -> false; force_synchronous_checkins -> false]
2020-01-19 11:14:47,295 main DEBUG [c.m.v.c.i.C3P0PooledConnectionPoolManager:204] log | Created new pool for auth, username (masked): ''.
2020-01-19 11:14:47,296 main DEBUG [c.m.v.r.BasicResourcePool:204] log | acquire test -- pool size: 0; target_pool_size: 3; desired target? 1
2020-01-19 11:14:47,297 main DEBUG [c.m.v.r.BasicResourcePool:204] log | awaitAvailable(): [unknown]
2020-01-19 11:14:48,690 C3P0PooledConnectionPoolManager[identityToken->1hgec1aa71gkv1fm1n5rn52|58feb6b0]-HelperThread-#0 DEBUG [c.m.v.r.BasicResourcePool:207] log | An exception occurred while acquiring a poolable resource. Will retry.
java.sql.SQLException: ORA-01017: invalid username/password; logon denied
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:441)
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:436)
at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:1061)
at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:550)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252)
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:499)
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:1279)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:663)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:688)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:39)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:691)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1176)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1163)
at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1908)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
The wallet files are correctly generated since I have tested with a simple application.
Does anybody knows how to configure Quartz to be able to use Oracle wallet?
Upvotes: 1
Views: 1302