1

我支持的应用程序使用带有 Oracle 数据库的Quartz Scheduler 2.3.2 版。
用户和密码凭据在属性文件的Quartz 配置数据源部分中指定。
这是运行良好的配置属性文件:

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,

我设法使 Oracle 钱包与自定义数据库一起工作。
这样可以避免在配置中指定纯文本密码。使用Oracle 工具生成
一对加密文件cwallet.sso& 。并在系统 ( ) 或连接属性 中指定其位置路径。ewallet.p12mkstore
oracle.net.wallet_location-D

不幸的是,我无法让它与 Quartz Scheduler 一起工作。
因此,当添加钱包文件和位置并从石英配置中删除用户和密码时,返回:

java.sql.SQLException: ORA-01017: invalid username/password; logon denied

调试Quartz初始化,好像C3P0PooledConnectionPoolManager得到了空用户和密码,并没有真正使用Oracle钱包指示,所以登录失败。这里抛出的日志和异常:

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)

钱包文件是正确生成的,因为我已经用一个简单的应用程序进行了测试。
有人知道如何配置 Quartz 以使用 Oracle 钱包吗?

4

0 回答 0