简体   繁体   中英

java.lang.NoSuchMethodError: org.springframework.scheduling.quartz.SchedulerFactoryBean.getScheduler()Lorg/quartz/Scheduler;

I don't know what I'm doing wrong here. I'm getting error

java.lang.NoSuchMethodError: org.springframework.scheduling.quartz.SchedulerFactoryBean.getScheduler()Lorg/quartz/Scheduler;

this is caused when public class myJobLauncher {

@Autowired
@Qualifier("myQuartzScheduler")
    private  SchedulerFactoryBean scheduler_factory = null;
.......
    ........
        Scheduler someScheduler = scheduler_factory.getScheduler();

and here are my xml files

    <?xml version="1.0" encoding="UTF-8"?>
<beans  xmlns="http://www.springframework.org/schema/beans"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
        http://www.springframework.org/schema/task
        http://www.springframework.org/schema/task/spring-task-4.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-4.0.xsd">          
 ....
 <bean id="myQuartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
 <property name="autoStartup">
  <value>true</value>
</property>
<property name="name">
  <value>myScheduler</value>
</property>
<property name="quartzProperties">
  <props>
    <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
    <prop key="org.quartz.threadPool.threadCount">1</prop>
    <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
    <prop key="org.quartz.scheduler.skipUpdateCheck">true</prop>
  </props>
</property>
  <property name="jobFactory">
        <bean  class="org.springframework.scheduling.quartz.SpringBeanJobFactory" />
  </property>

not sure why i'm getting that exception

here is my pom file entries org.quartz-scheduler quartz 1.8.6

using spring framework 4.0.0

added all spring-context-support,spring-context,beans,transaction.

we have some client code which is using above version of quartz ,we are integrating their spring project and adding enhancements to it. so bottom line is we cannot modify their code .

i finally got around this issue.

i have included following explicitly in my pom file. i was under impression this will be automatically added as its used by Quartz.

<dependency>
  <groupId>asm</groupId>
   <artifactId>asm</artifactId>
   <version>3.2</version>
</dependency>

Also moved that Quartz configuration to separate xml file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM