Я создаю кварцевый планировщик в памяти в Spring Boot, но получаю ошибку соединения.У меня есть подключенная база данных «оракул».как только я бегу, я получаю следующую ошибку.Кто-нибудь может помочь
ERROR [http-nio-80-exec-1] org.apache.juli.logging.DirectJDKLog: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': java.sql.SQLException: Connections could not be acquired from the underlying database!
это мой файл quartz.properties
#============================================================================
# Configure Main Scheduler Properties
#============================================================================
org.quartz.scheduler.instanceId = AUTO
org.quartz.scheduler.makeSchedulerThreadDaemon = true
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.makeThreadsDaemons = true
#org.quartz.threadPool.threadCount= 20
#org.quartz.threadPool.threadPriority= 5
#============================================================================
# Configure JobStore
#============================================================================
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.useProperties=true
org.quartz.jobStore.misfireThreshold=25000
org.quartz.jobStore.tablePrefix=QRTZ_
org.quartz.jobStore.isClustered=false
org.quartz.jobStore.dataSource=myDS
#============================================================================
# Configure Datasources
#============================================================================
org.quartz.dataSource.myDS.driver = oracle.jdbc.pool.OracleDataSource
org.quartz.dataSource.myDS.URL = jdbc:oracle:thin:@10.50.50.123:1521:fdf
org.quartz.dataSource.myDS.user = username
org.quartz.dataSource.myDS.password = password
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery = select 1
так я создал планировщик в классе Controller
@RequestMapping("/start")
public String start() throws SchedulerException {
Scheduler scheduler;
SchedulerFactory schedulerFactory = new StdSchedulerFactory(quartzProperties());
scheduler = schedulerFactory.getScheduler();
JobDetail jobDetail =
JobBuilder.newJob(Job1.class)
.usingJobData("job1", "description")
.storeDurably(true)
.requestRecovery(true)
.build();
scheduler.scheduleJob(jobDetail, Trigger1.fire());
scheduler.start();
return "redirect:/";
}
@Bean
public Properties quartzProperties() throws IOException {
PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
propertiesFactoryBean.setLocation(new ClassPathResource("/quartz.properties"));
propertiesFactoryBean.afterPropertiesSet();
return propertiesFactoryBean.getObject();
}
и Job1.class
@Slf4j
public class Job1 implements Job {
@Override
public void execute(JobExecutionContext jobContext) {
JobDetail jobDetail = jobContext.getJobDetail();
log.info(
"\nname: {}, \nstart: {}, \nnext: {}",
jobDetail.getJobDataMap().getString("job 1"),
jobContext.getFireTime(),
jobContext.getNextFireTime());
}
}
и это класс Trigger1
public class Trigger1 {
public static Trigger trigger;
public static Trigger fire() {
trigger =
TriggerBuilder.newTrigger()
.withIdentity("trigger 1")
.startAt(new Date())
.withSchedule(CronScheduleBuilder.cronSchedule("/1 * * ? * * *"))
.build();
return trigger;
}
}
Более того, я запускаю сценарии sql в моем db tables_oracle.sql