尝试将Quartz调度程序集成到spring应用程序中时,我尝试使用org.quartz.impl.jdbcjobstore.JobStoreTX
添加持久性
与mysql上的数据存储。
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = WDS
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.dontSetAutoCommitFalse = false
org.quartz.dataSource.WDS.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.WDS.debugUnreturnedConnectionStackTraces = true
org.quartz.dataSource.WDS.URL = jdbc:mysql://url:port/DB?useSSL=true&verifyServerCertificate=false
org.quartz.dataSource.WDS.user = xxx
org.quartz.dataSource.WDS.password = xxx
org.quartz.dataSource.WDS.maxConnections = 4
以下是我得到的错误
引起:com.mchange.v2.resourcepool.CannotAcquireResourceException:ResourcePool无法从其主工厂或源获取资源。 在com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1469) 在com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:644) 在com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:554) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:758) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:685)
Caused by: java.sql.SQLException: java.lang.NoSuchMethodError: sun.security.provider.certpath.AlgorithmChecker.<init>(Ljava/security/AlgorithmConstraints;)V
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:877)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:873)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:443)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
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:1138)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
引起:org.quartz.JobPersistenceException:无法从数据源'WatchdogsDS'获取数据库连接:java.sql.SQLException:无法从底层数据库获取连接! 在org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:783) 在org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:71) 在org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3846) 在org.quartz.impl.jdbcjobstore.JobStoreTX.executeInLock(JobStoreTX.java:93) 在org.quartz.impl.jdbcjobstore.JobStoreSupport.executeWithoutLock(JobStoreSupport.java:3785) 在org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1524) 在org.quartz.core.QuartzScheduler.getTrigger(QuartzScheduler.java:1499) 在org.quartz.impl.StdScheduler.getTrigger(StdScheduler.java:508) 在org.springframework.scheduling.quartz.SchedulerAccessor.addTriggerToScheduler(SchedulerAccessor.java:291) 在org.springframework.scheduling.quartz.SchedulerAccessor.registerJobsAndTriggers(SchedulerAccessor.java:235) 在org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:510) 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ...省略了29个常见帧
答案 0 :(得分:1)
您提到的问题可能是由多种原因引起的。首先检查数据库版本。我有最新版本的mysql(8.0.11)的问题,默认情况下采用身份验证类型&#34; caching_sha2_password &#34;。
更改为mysql版本5.7解决了我的问题,默认情况下将身份验证类型设置为&#34; 标准&#34;。
N.B不要忘记添加所需的管理角色和架构特权