我不知道我在这里做错了什么。我收到错误
java.lang.NoSuchMethodError: org.springframework.scheduling.quartz.SchedulerFactoryBean.getScheduler()Lorg/quartz/Scheduler;
这是由于 公共(public)课 myJobLauncher {
@Autowired
@Qualifier("myQuartzScheduler")
private SchedulerFactoryBean scheduler_factory = null;
.......
........
Scheduler someScheduler = scheduler_factory.getScheduler();
这是我的xml文件
<?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>
不知道为什么我得到那个异常
这是我的 pom 文件条目 org.quartz-调度程序 quartz 1.8.6
使用 spring 框架 4.0.0
添加了所有 spring-context-support,spring-context,beans,transaction。
我们有一些使用上述版本 quartz 的客户端代码,我们正在集成他们的 spring 项目并向其添加增强功能。所以底线是我们不能修改他们的代码。
最佳答案
我终于解决了这个问题。
我在我的 pom 文件中明确包含了以下内容。我的印象是这将自动添加为 Quartz 使用。
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.2</version>
</dependency>
还将 Quartz 配置移动到单独的 xml 文件中。
关于java.lang.NoSuchMethodError : org. springframework.scheduling.quartz.SchedulerFactoryBean.getScheduler()Lorg/quartz/Scheduler;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20849080/