2017-04-03 3 views
0

私たちのアプリケーションの1つは、Springを2.5.6から4.2.5に、そしてクォーツ1.6.5から2.2.2にアップグレードしています。 私は問題を1つずつ解決するために取り組んできましたが、私はうまくいかないようなものです。抽象クラス/ Beanの周りにクォーツとスプリングのアップグレードに問題があります

エラーは次のとおりです。

<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> 

編集4/4/17 7:59: 私は

親抽象クラスを作成してみましたここ

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 

は私の春のコンテキストファイルであります

<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) 

私はこの問題を解決するかどうかはわかりませんか?

+0

ここで、PvSchedulerプロパティを定義しましたか? – fabfas

+0

@fabfas これはquartzScheduler Beanにあります。 – russell1997

+0

@fabfasあなたはBeanも抽象的であるべきだと言っていますか? – russell1997

答えて

0

アップグレードはコードがすべての抽象メソッドを実装していなかったので、問題はQuartzTaskSchedulerの周りにありました。私はそれらをすべて実装しなければなりませんでした。親クラスが変更されたため、新しい抽象メソッドが追加されたか、または一部のメソッドのシグネチャが変更された可能性があります。

関連する問題