gpt4 book ai didi

java - Spring 2.5 + quartz java.lang.NoClassDefFoundError : org/quartz/JobDetail

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:54:35 25 4
gpt4 key购买 nike

我对 quartz 库有疑问。我在 spring 2.5 中使用它:

<bean id="reminderBean" class="com.mail.timexis.ReminderBean">
<property name="mailSender">
<ref local="timexisMailSender" />
</property>
</bean>

<bean id="jobDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="reminderBean" />
<property name="targetMethod" value="execute" />
</bean>

<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="jobDetail" />
<!-- run every morning at 6 AM -->
<property name="cronExpression" value="* * * * * ?" />
</bean>

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

专家:

<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>1.8.4</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
</dependency>

当我运行 tomcat 时,它无法实例化“jobDetail”bean,因为它看不到 MethodInvokingJobDetailFactoryBean 类使用的 JobDetail 类 (原因:java.lang.NoClassDefFoundError:org/quartz/JobDetail)

Maven 下载 jars,我可以在 MavenDependencies 下看到它,我可以找到 JobDetail 类。

我认为这与 spring 2.5 和 quartz 的兼容性有关。有什么想法吗?

最佳答案

您是否将依赖项添加到 spring-context-support

它包含 org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean,根据堆栈跟踪,它似乎丢失了。

关于java - Spring 2.5 + quartz java.lang.NoClassDefFoundError : org/quartz/JobDetail,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9061887/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com