java.lang.ClassCastException: org.quartz.simpl.SimpleThreadPool нельзя преобразовать в org.quartz.spi.ThreadPool

Я создаю собственный модуль (приемник) весной Xd. Мне нужно создавать файл с регулярным интервалом в 4 часа, либо я получаю данные, либо не получаю данные в http-источнике. Я использую кварц-2.2.1.jar с spring- xd-1.2.0.RELEASE-dist и моя конфигурация xml выглядит так

<int:channel id="input" />

<int:channel id="output" />

<int:transformer input-channel="input"
    ref="edwSinkImpl" output-channel="output" />


<bean name="edwSinkImpl"
    class="com.xd.edwsink.impl.EdwSinkImpl">
    <property name="eDWUtil" ref="eDWUtil" />
</bean>

<bean name="eDWUtil"
    class="com.xd.edwsink.util.EDWUtil" scope="singleton">
    <property name="directory" value="C:\\tmp\\" />
    <property name="timeFormat" value="HHmmss" />
    <property name="fileAge" value="4" />
    <property name="filePrefix" value="OB" />
    <property name="fileExt" value="dat" />
    <property name="stagingFileExt" value="stage" />
    <property name="dateFormat" value="MMddyyyy" />
    <property name="deliMeter" value="," />
</bean>

<bean name="fileRotatorJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
    <property name="jobClass" value="com.xd.edwsink.impl.FileRotatorJob" />
    <property name="jobDataAsMap">
        <map>
            <entry key="util" value-ref="eDWUtil" />
        </map>
    </property>
    <property name="durability" value="true" />
</bean>

<bean id="fileRotationCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
    <property name="jobDetail" ref="fileRotatorJob" />
    <property name="cronExpression" value="0 0 0/4 * * ?" /> 
</bean>

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="jobDetails">
        <list>
            <ref bean="fileRotatorJob" />
        </list>
    </property>
    <property name="triggers">
        <list>
            <ref bean="fileRotationCronTrigger" />
        </list>
    </property>
</bean>

Код отлично работает при запуске вне среды spring-xd, но в среде SringXd env env я получаю следующую ошибку

modules\sink\edw-outbound-sink\config\edw-outbound-sink.xml]: Invocation of init method failed; nested exception is org.quartz.SchedulerException: ThreadPool class 'org.quartz.simpl.SimpleThreadPool' could not be i
nstantiated. [See nested exception: java.lang.ClassCastException: org.quartz.simpl.SimpleThreadPool cannot be cast to org.quartz.spi.ThreadPool]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
        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:194)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:736)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
        at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)
        at org.springframework.xd.module.core.SimpleModule.initialize(SimpleModule.java:213)
        at org.springframework.xd.dirt.module.ModuleDeployer.doDeploy(ModuleDeployer.java:217)
        at org.springframework.xd.dirt.module.ModuleDeployer.deploy(ModuleDeployer.java:200)
        at org.springframework.xd.dirt.server.container.DeploymentListener.deployModule(DeploymentListener.java:365)
        at org.springframework.xd.dirt.server.container.DeploymentListener.deployStreamModule(DeploymentListener.java:334)
        at org.springframework.xd.dirt.server.container.DeploymentListener.onChildAdded(DeploymentListener.java:181)
        at org.springframework.xd.dirt.server.container.DeploymentListener.childEvent(DeploymentListener.java:149)
        at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509)
        at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503)
        at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92)
        at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
        at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83)
        at org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500)
        at org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35)
        at org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        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.SchedulerException: ThreadPool class 'org.quartz.simpl.SimpleThreadPool' could not be instantiated. [See nested exception: java.lang.ClassCastException: org.quartz.simpl.SimpleThreadPool canno
t be cast to org.quartz.spi.ThreadPool]
        at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:843)
        at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1519)
        at org.springframework.scheduling.quartz.SchedulerFactoryBean.createScheduler(SchedulerFactoryBean.java:597)
        at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:480)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
        ... 34 more
Caused by: java.lang.ClassCastException: org.quartz.simpl.SimpleThreadPool cannot be cast to org.quartz.spi.ThreadPool
        at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:841)
        ... 39 more
}

person hunter    schedule 27.09.2015    source источник
comment
Вы используете несовместимые версии банок (или по крайней мере одна из банок в вашем пути к классам несовместима). Проверьте, какая версия кварца совместима с вашей версией spring-xd.   -  person Augusto    schedule 27.09.2015
comment
Звучит как дубликат stackoverflow.com/questions/32544256/   -  person dturanski    schedule 27.09.2015
comment
Спасибо, что указали на ссылку выше. Проблема решена. кварц-2.2.1.jar совместим с spring-xd-1.2.0.RELEASE-dist. Все, что я сделал, это скопировалоquart-2.2.1.jar в папку xd/lib и удалило его из пользовательской библиотеки модулей.   -  person hunter    schedule 27.09.2015