Весной 3 кварцевых планировщика я получаю Execption - PullRequest
0 голосов
/ 15 мая 2018

Весной 3 приложения кварцевого планировщика я получаю java.lang.IncompatibleClassChangeError

Здесь всего Exception Log

org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.scheduling.quartz.JobDetailBean] for bean with name 'JobOne' defined in class path resource [resources/quartz-context.xml]: problem with class file or dependent class; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.JobDetailBean has interface org.quartz.JobDetail as super class
            at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1265)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
            at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)
            at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:590)
            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
            at com.fourgid.epdsscheduler.MainScheduleApp.init(MainScheduleApp.java:21)
            at javax.servlet.GenericServlet.init(GenericServlet.java:158)
            at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
            at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
            at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
            at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
            at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
            at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
            at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
            at java.util.concurrent.FutureTask.run(FutureTask.java:138)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:619) 

кварц-context.xml

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

    <bean id="jobA" class="com.fourgid.quartz.schedules.JobOneTrigger" />
    <bean id="jobB" class="com.fourgid.quartz.schedules.JobTwoTrigger" />
    <bean id="jobC" class="com.fourgid.quartz.schedules.JobThreeTrigger" />

    <!-- Quartz Job -->
    <bean name="JobOne" class="org.springframework.scheduling.quartz.JobDetailBean">
        <property name="jobClass" value="com.fourgid.quartz.schedules.JobOneTrigger" />
    </bean>

    <bean name="JobTwo" class="org.springframework.scheduling.quartz.JobDetailBean">
        <property name="jobClass" value="com.fourgid.quartz.schedules.JobTwoTrigger" />
    </bean>

    <bean name="JobThree" class="org.springframework.scheduling.quartz.JobDetailBean">
        <property name="jobClass" value="com.fourgid.quartz.schedules.JobThreeTrigger" />
    </bean>

    <!-- Cron Trigger, run every 5 seconds -->
    <bean id="cronTriggerJobOne" class="org.springframework.scheduling.quartz.CronTriggerBean">
        <property name="jobDetail" ref="JobOne" />
        <property name="cronExpression" value="0 0 1 ? * *" />
    </bean>

    <bean id="cronTriggerJobTwo" class="org.springframework.scheduling.quartz.CronTriggerBean">
        <property name="jobDetail" ref="JobTwo" />
        <property name="cronExpression" value="0 0 9 ? * *" />
    </bean>

    <bean id="cronTriggerJobThree" class="org.springframework.scheduling.quartz.CronTriggerBean">
        <property name="jobDetail" ref="JobThree" />
        <property name="cronExpression" value="0 0 3 ? * *" />
    </bean>

    <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        <property name="triggers">
            <list>
                <ref bean="cronTriggerJobOne" />
                <ref bean="cronTriggerJobTwo" />
                <ref bean="cronTriggerJobThree" />
            </list>
        </property>
    </bean>

</beans>

Спасибо за любую помощь

1 Ответ

0 голосов
/ 15 мая 2018

API Quartz 2 сильно изменены. В этот момент Spring 3 НЕ СОВМЕСТИМО с кварцем 2.

Если вы используете Spring 3.x и Quartz 2.1.x, сделайте только два изменения.

1-й: для простого триггера

Использование class=”org.springframework.scheduling.quartz.SimpleTriggerFactoryBean”>

2-й: для Cron Trigger

Использование class=”org.springframework.scheduling.quartz.CronTriggerFactoryBean”>

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...