quartz2.1.5 调用 scheduler.start()方法时报异常

quartz2.1.5 调用 scheduler.start()方法时报这样一个异常:
严重: An error occurred while scanning for the next triggers to fire.
org.quartz.JobPersistenceException: Couldn't acquire next trigger: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=1' at line 1 [See nested exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=1' at line 1]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2840)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$41.execute(JobStoreSupport.java:2755)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3811)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2751)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:264)
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=1' at line 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3170)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3099)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1248)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTriggerToAcquire(StdJDBCDelegate.java:2571)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2781)
... 4 more

我数据库用的是mysql,quartz.properties配置文件时这样的:
org.quartz.scheduler.instanceName: SchedulerName
#是否支持远程管理 false:不支持 (服务端)
org.quartz.scheduler.rmi.export: false
#是否支持远程代理 false:不支持 (客服端)
org.quartz.scheduler.rmi.proxy: false
#如果你要 Quartz 在调用你的 Job 的 execute 之前启动一个 UserTransaction 的话,设置这个属性为 true 。
#这个事物将在 Job 的 execute 方法完成和 JobDataMap (假如是一个 StatefulJob ) 更新后提交。默认值为 false 。
org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
#默认线程池类
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
#最多只能有50个线程并发

org.quartz.threadPool.threadCount: 50
#线程优先级别
org.quartz.threadPool.threadPriority: 5
#指定由石英产生的线程将继承范围内的初始化线程的ClassLoader(线程初始化石英实例)。
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
#线程之间错开后允许间隔时间 毫秒为单位 如果超过这个时间 下一个线程不执行 反之 执行
org.quartz.jobStore.misfireThreshold: 60000
##所有的Quartz数据,例如Job和Trigger的细节信息被存储在内存中。 数据库:org.quartz.impl.jdbcjobstore.JobStoreTX:内存:org.quartz.simpl.RAMJobStore
org.quartz.jobStore.class: org.quartz.impl.jdbcjobstore.JobStoreTX
#根据选择的数据库类型不同而不同 PostgreSQLDelegate(mysql)
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate
#org.quartz.jobStore.dataSource = myDS
#org.quartz.jobStore.isClustered = false
#org.quartz.jobStore.useProperties = true
org.quartz.jobStore.tablePrefix = QRTZ_
#isClustered设置为"true"激活集群特性
org.quartz.jobStore.isClustered = false
org.quartz.jobStore.maxMisfiresToHandleAtATime=1

请问大神,这是什么原因啊?百度了好久,都没找到具体原因

1个回答

OPTION SQL_SELECT_LIMIT=1
改为
SET SQL_SELECT_LIMIT=1;
[url]http://forums.terracotta.org/forums/posts/list/8001.page[/url]

还有一种说法是mysql的bug,可以升级jdbc驱动
[quote]This is a common pb with MySQL 5.6 ; just update the jar jdbc connector :

  • download from this place : http://www.mysql.com/downloads/connector/j/
  • and extract the "mysql-connector-java-5.X.XX-bin.jar" from the zip
  • go to the gateway configuration page and edit the driver (database>drivers)[/quote]

[url]http://www.inductiveautomation.com/forum/viewtopic.php?f=72&p=35017[/url]

shy_snow
shy_snow mysql驱动包升级到5.几就好了
3 年多之前 回复
wangzhaojunhanxi
含溪涤心 我把myslq的驱动包按照他的要求升级到2.1.26还是报一样的问题,甚至连quartz都升到2.1.7最高了都没用,头痛啊
接近 7 年之前 回复
wangzhaojunhanxi
含溪涤心 呵呵 谢谢!
接近 7 年之前 回复
u011606457
_1_1_7_ 这个问题我没遇到过,也没试过这个设置
接近 7 年之前 回复
wangzhaojunhanxi
含溪涤心 请问将 OPTION SQL_SELECT_LIMIT=1 改为 SET SQL_SELECT_LIMIT=1;具体操作是在cmd里运行mysql>SET SQL_SELECT_LIMIT=1;就可以了吗?
接近 7 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
quartz与SPring scheduler.addjob()为空

scheduler.addJob(jobDetail, true); 并没有存入数据 后台也没有异常,请求哪位前辈指点一下,这是什么原因 其他的配置也都没有问题。 --quartz.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> <beans> <bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="dataSource" ref="jboss_dataSource" /> <property name="transactionManager" ref="transactionManager" /> <property name="applicationContextSchedulerContextKey" value="applicationContext" /> <property name="configLocation" value="classpath:quartz.properties" /> <!--这个是必须的,QuartzScheduler 延时启动,应用启动完后 QuartzScheduler 再启动 --> <property name="startupDelay" value="5" /> <!--这个是可选,QuartzScheduler 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了 --> <property name="overwriteExistingJobs" value="true" /> <property name="jobDetails"> <list> <ref bean="testBatch" /> </list> </property> </bean> <bean id="testBatch" class="com.sinosoft.core.spring.quartz.MethodInvokingJobDetailFactoryBean"> <!--shouldRecover属性为true,则当Quartz服务被中止后,再次启动任务时会尝试恢复执行之前未完成的所有任务 --> <property name="shouldRecover" value="true" /> <property name="durable" value="true" /> <property name="targetObject" ref="TestBatch" /> <property name="targetMethod" value="runTestBatch" /> </bean> </beans> --quartZ.properties org.quartz.scheduler.instanceName = DefaultQuartzScheduler org.quartz.scheduler.instanceId = AUTO org.quartz.scheduler.rmi.export = false org.quartz.scheduler.rmi.proxy = false org.quartz.scheduler.wrapJobExecutionInUserTransaction = false org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 10 org.quartz.threadPool.threadPriority = 5 org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true org.quartz.jobStore.misfireThreshold = 60000 org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX #org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate #org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate #org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.WebLogicDelegate #org.quartz.jobStore.useProperties = true org.quartz.jobStore.tablePrefix = QRTZ_ org.quartz.jobStore.isClustered = false #org.quartz.jobStore.clusterCheckinInterval = 300000 org.quartz.jobStore.maxMisfiresToHandleAtATime=1

【spring+quartz框架】scheduler.reschedulejob后执行了多次

关于spring+quartz框架配置多线程调度任务,小弟有一事一直没搞明白 一、quartz.properties中配置: #=============================================================== #Configure Main Scheduler Properties #=============================================================== org.quartz.scheduler.instanceName = QuartzScheduler org.quartz.scheduler.instanceId = AUTO #=============================================================== #Configure ThreadPool #=============================================================== org.quartz.threadPool.threadCount = 8 org.quartz.threadPool.threadPriority = 5 org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool #=============================================================== #Configure JobStore #=============================================================== org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore org.quartz.jobStore.misfireThreshold = 60000 二、XML配置文件中配置了jobDetail: <bean id="monitorSMSJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="server"/> <property name="targetMethod" value="monitorSMS"/> <property name="concurrent" value="true"/> </bean> <bean id="monitorSMSCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="monitorSMSJobDetail"/> <property name="cronExpression"> <value>0/15 * * * * ?</value><!-- 每隔15秒调度执行 --> </property> </bean> 三、实现类调度方法 public void monitorSMS() { //scheduler.rescheduleJob(monitorSMSCronTrigger.getName(), Scheduler.DEFAULT_GROUP, monitorSMSCronTrigger); System.out.println("enter.."); } 问题是: 因配置了15秒执行一次调度,如果屏蔽掉scheduler.rescheduleJob这行代码,则每次是一个线程执行,如15:30:00 work_1执行,15:30:15 work_2执行,以此类推;如果不屏蔽,则每次8个线程并发执行,且每个线程执行N多次(N无规律,几十次到上百次吧) 求教大神,1 这是什么原因? 2 如果想让8个线程每次执行一遍应该如何做?

quartz2里面Scheduler的triggerJob方法如何使用

triggerJob主要是用于执行一次任务的场景,传入jobKey即可启动该任务,在scheduler的api中有两个重载的方法,第一个参数为JobKey的方法,测试过,没有什么大问题,问题在于第二个方法,多了一个JobDataMap的参数,请问这个参数在Job实现类里面如何获取,我试过用context去取,结果发现context为null,还请高手赐教。 ``` //调用类 Trigger trigger = scheduler.getTrigger(TriggerKey.triggerKey("some-trigger", "group")); //这里,trigger和job都具有jobDataMap,均尝试过,仍然无法在job实现类中获取参数 JobDataMap jobDataMap = trigger.getJobDataMap(); jobDataMap.put("param1",some-value1); jobDataMap.put("param2",some-value2); scheduler.triggerJob(JobKey.jobKey("some-job", "group"), jobDataMap); //job实现类 public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { this.context = jobExecutionContext; // 使用triggerJob启动任务的时候,我发现context==null // 和一般情况使用scheduleJob传入JobDataMap的情况不一样 } ``` 下面是API ``` void triggerJob(JobKey jobKey) Trigger the identified JobDetail (execute it now). void triggerJob(JobKey jobKey, JobDataMap data) Trigger the identified JobDetail (execute it now). ```

spring-quartz的scheduler.rescheduleJob

scheduler.rescheduleJob 在重置表达式后,会自动调用一遍Job,这不是我想要的,重置后到了我的Cron表达式执行的时间再执行才对。我用的Trigger是:CronTrigger,没有startTime方法,用CronTriggerBean也没有此方法。求解决! ![图片说明](https://img-ask.csdn.net/upload/201505/28/1432825678_316420.jpg)

Quartz定时器启动报错

在配置使用quartz时报错,找了很久不知道怎么解决,可能是jar包的问题还是什么问题呢? 错误信息如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in class path resource [applicationContext-job.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.quartz.SchedulerContext.put(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.context.support.DefaultLifecycleProcessor.getLifecycleBeans(DefaultLifecycleProcessor.java:281) at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:131) at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:770) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.mspring.platform.web.listener.AbstractStartupListener.contextInitialized(AbstractStartupListener.java:26) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4728) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5162) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NoSuchMethodError: org.quartz.SchedulerContext.put(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; at org.springframework.scheduling.quartz.SchedulerFactoryBean.populateSchedulerContext(SchedulerFactoryBean.java:634) at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:481) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1625) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562) ... 24 more 看看哪位程序老大哥帮忙看看,谢谢!

quartz jobstore存储方式,schedule启动成功,但是没有执行job

scheduleManger执行成功,job以及trigger的相关信息也都有写在数据库中,但是根本就没有执行job,希望大家可以帮我解惑,谢谢 这是quartz.properties ``` org.quartz.scheduler.instanceName = DefaultQuartzScheduler org.quartz.scheduler.rmi.export: false org.quartz.scheduler.rmi.proxy: false org.quartz.scheduler.wrapJobExecutionInUserTransaction: false org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 10 org.quartz.threadPool.threadPriority: 5 org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate org.quartz.jobStore.tablePrefix = QRTZ_ org.quartz.jobStore.dataSource = myDS org.quartz.dataSource.myDS.driver = com.mysql.jdbc.Driver org.quartz.dataSource.myDS.URL = jdbc:mysql://localhost:3306/quartz?characterEncoding=utf-8&useSSL=false org.quartz.dataSource.myDS.user = root org.quartz.dataSource.myDS.password = 1234 org.quartz.dataSource.myDS.maxConnections = 30 ``` 这是 QuartzManager.java 文件 public class QuartzManager { private static SchedulerFactory gSchedulerFactory = new StdSchedulerFactory(); /** * 增加任务 * @param jobClass 任务实现类 * @param jobName 任务名称 * @param interval 间隔时间 * @param data 数据 */ public static void addJob(Class<? extends Job> jobClass, String jobName, int interval, Map<String, Object> data) { try { Scheduler sched = gSchedulerFactory.getScheduler(); JobDetail jobDetail = JobBuilder.newJob(jobClass) .withIdentity(jobName, "test3")//任务名称和组构成任务key .build(); jobDetail.getJobDataMap().putAll(data); // 触发器 SimpleTrigger trigger = TriggerBuilder.newTrigger() .withIdentity(jobName, "ttest3")//触发器key .startAt(DateBuilder.futureDate(1, IntervalUnit.SECOND)) .withSchedule(SimpleScheduleBuilder.simpleSchedule() .withIntervalInSeconds(interval) .repeatForever()) .build(); sched.scheduleJob(jobDetail, trigger); // 启动 if (!sched.isShutdown()) { sched.start(); } } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) throws InterruptedException { Map<String, Object> map = new HashMap<String, Object>(); map.put("id", "1"); String jobname = "aaa"; addJob(TestJob.class, "aaa", 1, map); try { Thread.sleep(10000); System.out.println("main end----------"); System.exit(1); } catch (InterruptedException e) { e.printStackTrace(); } } ``` ``` 这是TestJob.Java文件 import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; public class TestJob implements Job { public TestJob(){ } public void execute(JobExecutionContext jobexecutioncontext) throws JobExecutionException { String id = jobexecutioncontext.getJobDetail().getJobDataMap().getString("id"); System.out.println("threadId: " + Thread.currentThread().getId() + ", id: " + id); try { System.out.println("=====================>睡眠开始时间:"+System.currentTimeMillis()); Thread.sleep(10000); System.out.println("=====================>睡眠结束时间:"+System.currentTimeMillis()); } catch (InterruptedException e) { e.printStackTrace(); } } }

quartz项目启动到一半,不停止也不继续启动,求救

我一个quartz项目启动时没报错,但是不知道为什么就是不继续往下启动,控制台输出 2018-3-22 19:37:07 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jdk1.6.0_32\bin;E:\Tomcat 6.0\bin 2018-3-22 19:37:07 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 2018-3-22 19:37:07 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 579 ms 2018-3-22 19:37:07 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2018-3-22 19:37:07 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.33 2018-3-22 19:37:07 org.apache.catalina.startup.HostConfig deployDescriptor 信息: Deploying configuration descriptor manager.xml 2018-3-22 19:37:07 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory bhylhlpt 2018-3-22 19:37:09 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext 2018-3-22 19:37:19 org.quartz.simpl.SimpleThreadPool initialize 信息: Job execution threads will use class loader of thread: main 2018-3-22 19:37:19 org.quartz.core.SchedulerSignalerImpl <init> 信息: Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl 2018-3-22 19:37:19 org.quartz.core.QuartzScheduler <init> 信息: Quartz Scheduler v.1.8.5 created. 2018-3-22 19:37:20 org.quartz.impl.jdbcjobstore.JobStoreSupport initialize 信息: Using db table-based data access locking (synchronization). 2018-3-22 19:37:20 org.quartz.impl.jdbcjobstore.JobStoreCMT initialize 信息: JobStoreCMT initialized. 2018-3-22 19:37:20 org.quartz.core.QuartzScheduler initialize 信息: Scheduler meta-data: Quartz Scheduler (v1.8.5) 'schedule' with instanceId 'zz1521718639046' 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 10 threads. Using job-store 'org.springframework.scheduling.quartz.LocalDataSourceJobStore' - which supports persistence. and is clustered. 2018-3-22 19:37:20 org.quartz.impl.StdSchedulerFactory instantiate 信息: Quartz scheduler 'schedule' initialized from an externally provided properties instance. 2018-3-22 19:37:20 org.quartz.impl.StdSchedulerFactory instantiate 信息: Quartz scheduler version: 1.8.5 2018-3-22 19:37:20 org.quartz.core.QuartzScheduler setJobFactory 信息: JobFactory set to: org.springframework.scheduling.quartz.AdaptableJobFactory@166ff9c 2018-3-22 19:37:21 org.quartz.simpl.SimpleThreadPool initialize 信息: Job execution threads will use class loader of thread: main 2018-3-22 19:37:21 org.quartz.core.SchedulerSignalerImpl <init> 信息: Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl 2018-3-22 19:37:21 org.quartz.core.QuartzScheduler <init> 信息: Quartz Scheduler v.1.8.5 created. 2018-3-22 19:37:21 org.quartz.impl.jdbcjobstore.JobStoreSupport initialize 信息: Using db table-based data access locking (synchronization). 2018-3-22 19:37:21 org.quartz.impl.jdbcjobstore.JobStoreCMT initialize 信息: JobStoreCMT initialized. 2018-3-22 19:37:21 org.quartz.core.QuartzScheduler initialize 信息: Scheduler meta-data: Quartz Scheduler (v1.8.5) 'startCancleQuertz' with instanceId 'zz1521718641219' 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 10 threads. Using job-store 'org.springframework.scheduling.quartz.LocalDataSourceJobStore' - which supports persistence. and is clustered. 2018-3-22 19:37:21 org.quartz.impl.StdSchedulerFactory instantiate 信息: Quartz scheduler 'startCancleQuertz' initialized from an externally provided properties instance. 2018-3-22 19:37:21 org.quartz.impl.StdSchedulerFactory instantiate 信息: Quartz scheduler version: 1.8.5 2018-3-22 19:37:21 org.quartz.core.QuartzScheduler setJobFactory 信息: JobFactory set to: org.springframework.scheduling.quartz.AdaptableJobFactory@346239 我试着把quartz给注释掉就可以启动了,但是这个项目的主要功能都在quartz,注释了就等于废了,查了好久的百度都解决不了,求大神支招

java quartz 初始化异常

2016-04-19 02:11:11,421 (QuartzScheduler.java:2425)-An error occured instantiating job to be executed. job= 'maxbet_job_group.isn_job_group' org.quartz.SchedulerException: Problem instantiating class 'com.thrash.job.DataJob' - [See nested exception: java.util.ConcurrentModificationException] at org.quartz.core.JobRunShell.initialize(JobRunShell.java:134) at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:375) Caused by: java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(Unknown Source) at java.util.HashMap$EntryIterator.next(Unknown Source) at java.util.HashMap$EntryIterator.next(Unknown Source) at org.quartz.utils.DirtyFlagMap$DirtyFlagIterator.next(DirtyFlagMap.java:314) at org.quartz.utils.DirtyFlagMap$DirtyFlagMapEntryIterator.next(DirtyFlagMap.java:375) at org.quartz.utils.DirtyFlagMap$DirtyFlagMapEntryIterator.next(DirtyFlagMap.java:368) at java.util.HashMap.putAll(Unknown Source) at org.quartz.utils.DirtyFlagMap.putAll(DirtyFlagMap.java:184) at org.quartz.simpl.PropertySettingJobFactory.newJob(PropertySettingJobFactory.java:72) at org.quartz.core.JobRunShell.initialize(JobRunShell.java:127) ... 1 more

SpringMVC+quartz 报错

配置文件: ```<!-- 执行调度任务业务类 --> <bean id="consultJob" class="com.bytc.consult.quartz.ConsultRedisJob"> </bean> <!-- 配置执行类和方法 --> <bean id="consultJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="consultJob"></property> <property name="targetMethod" value="consultTypeCopy"></property> <property name="concurrent" value="false"></property> </bean> <!-- 配置定时执行时间 --> <bean id="consultTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <property name="jobDetail" ref="consultJobDetail"></property> <property name="cronExpression"> <value>0/10 * * * * ?</value> </property> </bean> <!-- 配置调度资源 --> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="false" autowire="no"> <property name="autoStartup" value="true"></property> <property name="startupDelay" value="0"/> <property name="triggers"> <list> <ref local="consultTrigger"/> </list> </property> </bean> ``` 报错信息: ```Caused by: org.quartz.JobPersistenceException: The job (DEFAULT.consultJobDetail) referenced by the trigger does not exist. at org.quartz.simpl.RAMJobStore.storeTrigger(RAMJobStore.java:422) at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:932) at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:258) at org.springframework.scheduling.quartz.SchedulerAccessor.addTriggerToScheduler(SchedulerAccessor.java:312) at org.springframework.scheduling.quartz.SchedulerAccessor.registerJobsAndTriggers(SchedulerAccessor.java:235) at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:512) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ... 57 more ``` 使用 RAMJobStore 模式,不需要持久化到数据,启动时抛出如上异常?求解答!!

Spring 集成Quartz 不能持久话

#持久化配置 **org.quartz.jobStore.class:org.quartz.impl.jdbcjobstore.JobStoreTX** org.quartz.jobStore.driverDelegateClass:org.quartz.impl.jdbcjobstore.StdJDBCDelegate org.quartz.jobStore.useProperties:true 运行提示:9:50:57.296 [main] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - Adding TriggerPersistenceDelegate of type: org.quartz.impl.jdbcjobstore.SimpleTriggerPersistenceDelegate 09:50:57.297 [main] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - Adding TriggerPersistenceDelegate of type: org.quartz.impl.jdbcjobstore.CronTriggerPersistenceDelegate 09:50:57.299 [main] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - Adding TriggerPersistenceDelegate of type: org.quartz.impl.jdbcjobstore.CalendarIntervalTriggerPersistenceDelegate 09:50:57.301 [main] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - Adding TriggerPersistenceDelegate of type: org.quartz.impl.jdbcjobstore.DailyTimeIntervalTriggerPersistenceDelegate 09:50:57.312 [main] INFO o.q.impl.jdbcjobstore.JobStoreTX - Freed 0 triggers from 'acquired' / 'blocked' state. 09:50:57.320 [main] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - Found 0 triggers that missed their scheduled fire-time. 09:50:57.322 [main] INFO o.q.impl.jdbcjobstore.JobStoreTX - Recovering 0 jobs that were in-progress at the time of the last shut-down. 09:50:57.322 [main] INFO o.q.impl.jdbcjobstore.JobStoreTX - Recovery complete. 09:50:57.323 [main] INFO o.q.impl.jdbcjobstore.JobStoreTX - Removed 0 'complete' triggers. 09:50:57.324 [main] INFO o.q.impl.jdbcjobstore.JobStoreTX - Removed 0 stale fired job entries. 09:50:57.325 [main] DEBUG o.q.i.jdbcjobstore.SimpleSemaphore - Lock 'TRIGGER_ACCESS' retuned by: main 09:50:57.326 [main] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - JobStore background threads started (as scheduler was started). 09:50:57.327 [main] INFO org.quartz.core.QuartzScheduler - Scheduler scheduler_$_NON_CLUSTERED started. 09:50:57.327 [QuartzScheduler_scheduler-NON_CLUSTERED_MisfireHandler] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - MisfireHandler: scanning for misfires... 09:50:57.327 [main] DEBUG o.s.c.s.DefaultLifecycleProcessor - Successfully started bean 'scheduler' 09:50:57.329 [QuartzScheduler_scheduler-NON_CLUSTERED_MisfireHandler] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - Found 0 triggers that missed their scheduled fire-time. 09:50:57.331 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties] 09:50:57.331 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment] 09:50:57.332 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null] 09:50:57.332 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'scheduler' 09:50:57.333 [scheduler_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers 09:50:57.356 [main] INFO org.quartz.impl.StdSchedulerFactory - Using default implementation for ThreadExecutor 09:50:57.357 [main] INFO org.quartz.simpl.SimpleThreadPool - Job execution threads will use class loader of thread: main 09:50:57.359 [main] INFO o.quartz.core.SchedulerSignalerImpl - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl 09:50:57.360 [main] INFO org.quartz.core.QuartzScheduler - Quartz Scheduler v.2.2.1 created. 09:50:57.360 [main] INFO org.quartz.simpl.RAMJobStore - RAMJobStore initialized. 09:50:57.360 [main] INFO org.quartz.core.QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v2.2.1) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' 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 10 threads. **Using job-store 'org.quartz.simpl.RAMJobStore**' - which does not support persistence. and is not clustered. 09:50:57.360 [main] INFO org.quartz.impl.StdSchedulerFactory - Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' 09:50:57.361 [main] INFO org.quartz.impl.StdSchedulerFactory - Quartz scheduler version: 2.2.1 09:50:57.362 [main] INFO org.quartz.core.QuartzScheduler - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. 09:50:57.362 [DefaultQuartzScheduler_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers 09:50:57.370 [DefaultQuartzScheduler_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread - batch acquisition of 1 triggers 09:50:58.019 [Timer-0] DEBUG org.quartz.utils.UpdateChecker - Checking for available updated version of Quartz... 运行的时候就变成了内存方式,哪位大神遇到过,帮忙看看吧

org.quartz.SchedulerConfigException这是什么情况,咋解决

org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) [See nested exception: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))]] at org.quartz.impl.jdbcjobstore.JobStoreSupport.schedulerStarted(JobStoreSupport.java:692) at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:567) at org.quartz.impl.StdScheduler.start(StdScheduler.java:142) at servlet.remind.RemindStartListener.contextInitialized(RemindStartListener.java:28) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) [See nested exception: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))] at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:778) at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:71) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3784) at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverJobs(JobStoreSupport.java:834) at org.quartz.impl.jdbcjobstore.JobStoreSupport.schedulerStarted(JobStoreSupport.java:690) ... 12 more Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at tool.remind.MyPoolingconnectionProvider.getConnection(MyPoolingconnectionProvider.java:63) at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:775) ... 16 more Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4187) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4119) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:927) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1709) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1252) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2483) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2516) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2301) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346) at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556) at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545) ... 21 more

java quartz2.2.1怎么更新trigger,我根据官网的例子测试 执行无效,没报错!

TriggerKey triggerKey = TriggerKey.triggerKey("test", TRIGGERGROUP); CronTrigger trigger = (CronTrigger) this.scheduler.getTrigger(triggerKey); trigger.getTriggerBuilder().withIdentity(triggerKey) .withSchedule(CronScheduleBuilder.cronSchedule("*/2 * * * * ?")).build(); this.scheduler.rescheduleJob(triggerKey, trigger); 我开始设置5s一次,现在用新的trigger替换旧的,为什么没效果?求指导

springboot+quartz集群,启动时打印 NOT STARTED

启动是控制台打印:目前没有发现有什么影响,还请各位大神帮忙解答一下这个是什么意思,怎么解决 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 20 threads. Using job-store 'org.springframework.scheduling.quartz.LocalDataSourceJobStore' - which supports persistence. and is clustered.

Quartz+Spring+Hibernate集群环境下 ClusterManager: Error managing cluster: null

[2013-12-19 14:43:44] [ERROR] [QuartzScheduler_quartzScheduler-NON_CLUSTERED_ClusterManager] (org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3804)) - ClusterManager: Error managing cluster: null java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy28.rollback(Unknown Source) at org.quartz.impl.jdbcjobstore.JobStoreSupport.rollbackConnection(JobStoreSupport.java:3588) at org.quartz.impl.jdbcjobstore.JobStoreSupport.doCheckin(JobStoreSupport.java:3199) at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3798) at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.run(JobStoreSupport.java:3834) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHandler.invoke(AttributeRestoringConnectionInvocationHandler.java:71) ... 5 more Caused by: java.sql.SQLException: Closed Connection at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70) at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445) at oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:3450) at com.jolbox.bonecp.ConnectionHandle.rollback(ConnectionHandle.java:958) ... 10 more ##========================# quartz.properties配置如下: ##========================== # #Configure Main Scheduler Properties ##========================== org.quartz.scheduler.instanceName = quartzScheduler org.quartz.scheduler.instanceId = AUTO org.quartz.scheduler.rmi.export = false org.quartz.scheduler.rmi.proxy = false org.quartz.scheduler.wrapJobExecutionInUserTransaction = false ##========================= # #Configure ThreadPool ##========================= org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 10 org.quartz.threadPool.threadPriority = 5 org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true ##======================== # #Configure JobStore ##======================== org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate org.quartz.jobStore.misfireThreshold = 60000 org.quartz.jobStore.tablePrefix = QRTZ_ org.quartz.jobStore.maxMisfiresToHandleAtATime=10 org.quartz.jobStore.isClustered = true org.quartz.jobStore.clusterCheckinInterval = 15000 #============================# applicationContext-quartz-server.xml配置: #============================# <bean id="quartzDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>${jdbc.driverClassName}</value> </property> <property name="url"> <value>${jdbc.url}</value> </property> <property name="username"> <value>${jdbc.username}</value> </property> <property name="password"> <value>${jdbc.password}</value> </property> <property name="maxActive" value="5"></property> <property name="maxIdle" value="20"></property> <property name="maxWait" value="50"></property> <property name="defaultAutoCommit" value="true"></property> </bean> <bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="dataSource" ref="quartzDataSource" /> <property name="applicationContextSchedulerContextKey" value="applicationContextKey" /> <property name="configLocation" value="classpath:config/quartz.properties" /> <property name="triggers"> <list> <ref bean="Trigger1" /> <ref bean="Trigger2" /> <ref bean="Trigger3" /> <ref bean="Trigger4"/> </list> </property> </bean> 四台机器集群,不压力测试没问题,压力测试就出现以上错误,求大神帮忙解决啊! quartz-all-1.6.6.jar

使用Quartz时出现的错误

错误: 信息: Reloading Context with name [/sjzlgl] is completed 2016-11-25 15:18:54,194 DEBUG [org.quartz.utils.ExceptionHelper] - Detected JDK support for nested exceptions. 2016-11-25 15:18:54,204 ERROR [org.quartz.core.ErrorLogger] - An error occured instantiating job to be executed. job= 'DEFAULT.jobDetailBean' org.quartz.SchedulerException: Job instantiation failed [See nested exception: java.lang.NullPointerException] at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:61) at org.quartz.core.JobRunShell.initialize(JobRunShell.java:132) at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:386) Caused by: java.lang.NullPointerException at org.springframework.scheduling.quartz.AdaptableJobFactory.createJobInstance(AdaptableJobFactory.java:79) at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:57) ... 2 more 2016-11-25 15:18:54,204 INFO [org.quartz.simpl.RAMJobStore] - All triggers of Job DEFAULT.jobDetailBean set to ERROR state. 2016-11-25 15:19:00,005 DEBUG [org.quartz.core.JobRunShell] - Calling execute on job DEFAULT.StartJob 配置文件 <?xml version="1.0" encoding="UTF-8"?> -<beans xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd" xmlns:task="http://www.springframework.org/schema/task" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns="http://www.springframework.org/schema/beans"> <bean class="com.ym.backadmin.testQuartz.GetNowDate" id="getNowDate"/> -<bean class="org.springframework.scheduling.quartz.JobDetailBean" id="jobDetailBean"> -<property name="jobDataAsMap"> -<map> <entry value-ref="getNowDate" key="jobData"/> </map> </property> </bean> -<bean class="org.springframework.scheduling.quartz.SimpleTriggerBean" id="simpleTriggerBean"> <property name="jobDetail" ref="jobDetailBean"/> <property name="startDelay" value="2000"/> <property name="repeatInterval" value="1000"/> </bean> -<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean" id=""> -<property name="triggers"> -<list> <ref bean="simpleTriggerBean"/> </list> </property> </bean> </beans> Job类和demo类 job: package com.ym.backadmin.testQuartz; import java.text.SimpleDateFormat; import java.util.Date; public class GetNowDate { public String getDate(){ return new SimpleDateFormat("yyyy-MM-DD HH:mm:ss").format(new Date()); } } demo: package com.ym.backadmin.testQuartz; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.springframework.scheduling.quartz.QuartzJobBean; public class QuartzDemo extends QuartzJobBean{ private GetNowDate getNowDate; public GetNowDate getGetNowDate() { return getNowDate; } public void setGetNowDate(GetNowDate getNowDate) { this.getNowDate = getNowDate; } @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { System.out.println(getNowDate.getDate()+":已经进行了QuartzDemo测试"); } }

Quartz 我一个调度器多调度多个任务,但是有时候不执行是为什么?

我是一个调度器去调度多个 jobDetail trigger ,但是有时候 调度不执行,也不报错,多个任务的jobDetail组名称和trigger组名用的是一个,和这个有关系吗? 代码如下:新增调度任务: ``` // 启动调度器 JobDetail jobDetail = JobBuilder.newJob(IotSchedulerTime.class).withIdentity(jobDetailName,jobDetailGroup).usingJobData("command", command).usingJobData("jobDetailName",jobDetailName).build(); // 表达式调度构建器(即任务执行的时间) CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(cron); // 按新的cronExpression表达式构建一个新的trigger CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(triggerName,triggerGroup).withSchedule(scheduleBuilder).build(); scheduler.start(); scheduler.scheduleJob(jobDetail, trigger); ``` 删除代码: ``` TriggerKey triggerKey = TriggerKey.triggerKey(triggerName, triggerGroup); scheduler.pauseTrigger(triggerKey);// 停止触发器 scheduler.unscheduleJob(triggerKey);// 移除触发器 scheduler.deleteJob(JobKey.jobKey(jobDeatailName, jobDetailGroup));// 删除任务 ```

quartz与mysql使用同一个数据源,请求不到连接

最近在做项目合并 本来的quartz与mysql合并到同一个数据库 我将quartz的DataSource设置为原来的mysql数据源(BoneCP) 在服务器报错 ``` 2020-01-07 11:40:10.163 [schedulerFactoryBean_QuartzSchedulerThread] ERROR [org.quartz.core.ErrorLogger-2460] An error occurred while scanning for the next triggers to fire. org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'springNonTxDataSource.schedulerFactoryBean': java.sql.SQLException: Timed out waiting for a free available connection. at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:168) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3774) at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2759) at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:264) Caused by: java.sql.SQLException: Timed out waiting for a free available connection. at com.jolbox.bonecp.BoneCP.getConnection(BoneCP.java:503) at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:114) at org.springframework.scheduling.quartz.LocalDataSourceJobStore$2.getConnection(LocalDataSourceJobStore.java:135) at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:165) ... 3 common frames omitted ``` BoneCP设置由原来的2个分区2个最大连接 改为4个分区5个最大连接 还是报这个错 ![图片说明](https://img-ask.csdn.net/upload/202001/08/1578475058_741073.png) 另外 quartz.properties的配置数据源 直接写数据库配置能成功 但是如果写成${}这种形式就不能成功 ``` org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': java.sql.SQLException: Connections could not be acquired from the underlying database! at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:777) at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:71) at org.quartz.impl.jdbcjobstore.JobStoreSupport.doCheckin(JobStoreSupport.java:3213) at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3836) at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.initialize(JobStoreSupport.java:3821) at org.quartz.impl.jdbcjobstore.JobStoreSupport.schedulerStarted(JobStoreSupport.java:688) at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:580) at org.quartz.impl.StdScheduler.start(StdScheduler.java:142) at org.springframework.scheduling.quartz.SchedulerFactoryBean$1.run(SchedulerFactoryBean.java:708) Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database! at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) at org.quartz.utils.PoolingConnectionProvider.getConnection(PoolingConnectionProvider.java:247) at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:774) ... 8 common frames omitted Caused by: 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) ... 12 common frames omitted ```

org.quartz.simpl.SimpleThreadPool如何使用

Java中quartz框架下的org.quartz.simpl.SimpleThreadPool类如何使用?或者说quartz的线程池如何使用?

quartz报错 java.sql.SQLException: Timed out waiting for a free available connection.

整合项目 将quartz和mysql合并为一个DataSource ``` 2020-01-07 11:44:10.162 [schedulerFactoryBean_QuartzSchedulerThread] ERROR [org.quartz.core.ErrorLogger-2460] An error occurred while scanning for the next triggers to fire. org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'springNonTxDataSource.schedulerFactoryBean': java.sql.SQLException: Timed out waiting for a free available connection. at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:168) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3774) at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2759) at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:264) Caused by: java.sql.SQLException: Timed out waiting for a free available connection. at com.jolbox.bonecp.BoneCP.getConnection(BoneCP.java:503) at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:114) at org.springframework.scheduling.quartz.LocalDataSourceJobStore$2.getConnection(LocalDataSourceJobStore.java:135) at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:165) ... 3 common frames omitted ```

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

ArrayList源码分析(入门篇)

ArrayList源码分析 前言: 写这篇博客的主要原因是,在我上一次参加千牵科技Java实习生面试时,有被面试官问到ArrayList为什么查找的速度较快,插入和删除的速度较慢?当时我回答得不好,很大的一部分原因是因为我没有阅读过ArrayList源码,虽然最后收到Offer了,但我拒绝了,打算寒假学得再深入些再广泛些,下学期开学后再去投递其他更好的公司。为了更加深入理解ArrayList,也为

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

玩转springboot启动banner定义所得

最近接手了一个springboot项目,不是不熟悉这个框架,启动时打印的信息吸引了我。 这不是我熟悉的常用springboot的打印信息啊,我打开自己的项目: 还真是的,不用默认的感觉也挺高大上的。一时兴起,就去研究了一下源代码,还正是有些收获,稍后我会总结一下。正常情况下做为一个老程序员,是不会对这种小儿科感兴趣的,不就是一个控制台打印嘛。哈哈! 于是出于最初的好奇,研究了项目的源代码。看到

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

立即提问
相关内容推荐