0
我们的应用之一是将Spring从2.5.6升级到4.2.5,将quartz从1.6.5升级到2.2.2。 我一直在努力解决一个接一个的问题,但我一直在努力解决这个问题,我似乎无法解决问题。石英和弹簧升级在抽象类/豆周围存在问题
的错误是:
2017-04-03 14:52:47,570 INFO {main} [org.quartz.core.QuartzScheduler] - Scheduler meta-data: Quartz Scheduler (v2.2.2) 'PvScheduler' 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.
2017-04-03 14:52:47,572 INFO {main} [org.quartz.impl.StdSchedulerFactory] - Quartz scheduler 'PvScheduler' initialized from an externally provided properties instance.
2017-04-03 14:52:47,574 INFO {main} [org.quartz.impl.StdSchedulerFactory] - Quartz scheduler version: 2.2.2
2017-04-03 14:52:47,576 INFO {main} [org.quartz.core.QuartzScheduler] - JobFactory set to: [email protected]7c
*** SaPvApp: Registering JVM shutdown hook
*** SaPvApp: version 17.1.0
*** SaPvApp: Adding service-stop event listeners
*** SaPvApp: Starting service at Mon Apr 03 14:52:47 CDT 2017
*** SaPvApp: Unexpected service error at Mon Apr 03 14:52:47 CDT 2017
org.springframework.beans.factory.BeanIsAbstractException: Error creating bean with name 'intAppService': Bean definition is abstract
at org.springframework.beans.factory.support.AbstractBeanFactory.checkMergedBeanDefinition(AbstractBeanFactory.java:1288)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:285)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054)
at AbstractCommandLineApplication.runApplication(AbstractCommandLineApplication.java:112)
at AbstractCommandLineApplication.runApplication(AbstractCommandLineApplication.java:54)
at cmd.SaPvApp.main(SaPvApp.java:18)
*** SaPvApp: Calling service stop event listeners
*** SaPvApp: Exiting service at Mon Apr 03 14:52:47 CDT 2017
*** SaPvApp ShutdownHook: Service shutdown initiated at Mon Apr 03 14:52:47 CDT 2017
*** SaPvApp ShutdownHook: Closing application context
2017-04-03 14:52:47,609 INFO {ApplicationShutdownHook} [org.springframework.context.support.FileSystemXmlApplicationContext] - Closing org.[email protected]63e31ee: startup date [Mon Apr 03 14:52:41 CDT 2017]; root of context hierarchy
2017-04-03 14:52:47,615 INFO {ApplicationShutdownHook} [org.springframework.context.support.DefaultLifecycleProcessor] - Stopping beans in phase 2147483647
2017-04-03 14:52:47,618 INFO {ApplicationShutdownHook} [org.springframework.scheduling.quartz.SchedulerFactoryBean] - Shutting down Quartz Scheduler
2017-04-03 14:52:47,619 INFO {ApplicationShutdownHook} [org.quartz.core.QuartzScheduler] - Scheduler PvScheduler_$_NON_CLUSTERED shutting down.
2017-04-03 14:52:47,620 INFO {ApplicationShutdownHook} [org.quartz.core.QuartzScheduler] - Scheduler PvScheduler_$_NON_CLUSTERED paused.
2017-04-03 14:52:47,621 INFO {ApplicationShutdownHook} [org.quartz.core.QuartzScheduler] - Scheduler PvScheduler_$_NON_CLUSTERED shutdown complete.
*** SaPvApp ShutdownHook: Service shutdown complete
这里是我的Spring上下文文件:
<bean name="intAppService" class="QuartzTaskScheduler" init-method="listen" abstract="true">
<property name="name" value="PvJobListener" />
<property name="quartzScheduler" ref="quartzScheduler"/>
</bean>
<bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="autoStartup" value="false" />
<property name="schedulerName" value="PvScheduler" />
<property name="triggers">
<list>
<ref bean="cronTrigger" />
</list>
</property>
</bean>
<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="serviceTask" />
<property name="targetMethod" value="run" />
<property name="concurrent" value="false" />
<property name="group" value="PV" />
<property name="name" value="${app.service.name}${app.service.instance}-Job" />
<!--<property name="jobListenerNames">
<list>
<value>PvJobListener</value>
</list>
</property>-->
</bean>
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="jobDetail" />
<!--<property name="cronExpression" value="10 0/01 * * * ?" />-->
<!-- run twice a day at 3am and 3pm -->
<property name="cronExpression" value="0 0 3,15 ? * *" />
<!-- run every 30 minutes, at 10 seconds after the minute (i.e. 10:00:10 am, 10:30:10 am, etc.)
<property name="cronExpression" value="10 0/30 * * * ?" /> -->
</bean>
编辑17年4月4日07:59: 我试图创建一个抽象父类
<bean name="intAppServiceParent" abstract = "true">
<property name="nameParent" value="PvJobListenerParent" />
<property name="quartzSchedulerParent" ref="quartzSchedulerParent"/>
</bean>
<bean name="intAppService" class="QuartzTaskScheduler" init-method="listen" parent = "intAppServiceParent">
<property name="name" value="PvJobListener" />
<property name="quartzScheduler" ref="quartzScheduler"/>
</bean>
但我得到这个错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'intAppService' defined in file [C:\Integration Apps\SAPV\config\SaPvApp-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [QuartzTaskScheduler]: Is it an abstract class?; nested exception is java.lang.InstantiationException
如果我不作Java代码抽象类,我得到这个编译错误:
The type QuartzTaskScheduler must implement the inherited abstract method SchedulerListener.triggersPaused(String)
我不知道如何解决这个问题?
您在哪里定义了PvScheduler属性? – fabfas
@fabfas 它在quartzScheduler bean中。 – russell1997
@fabfas您是否认为bean也应该是抽象的? – russell1997