本文介绍了使用CronTrigger和MySQL进行调度程序时发生ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

java.lang.ClassNotFoundException 当使用CronTrigger和MySQL在Java中执行调度程序时

java.lang.ClassNotFoundException when Using CronTrigger and MySQL to do scheduler in Java

我目前正在开发一个项目,该项目需要调度程序从服务器从MySQL数据库下载数据并将其放入存储在固定目录中的文本文件中.我正在使用CronTrigger和调度程序来完成此任务,并且我的项目将位于Tomcat 6.0/webapps目录中.但是,我在运行程序时遇到了这个问题.

I am currently developing a project that require scheduler to download data from MySQL database from a server and put it into a text file stored in a fixed directory. I am using CronTrigger and scheduler to accomplish this task and my project will be reside in Tomcat version 6.0/webapps directory. However, i encountered this problem when i run my program.

Jul 5, 2013 3:10:00 PM org.quartz.impl.jdbcjobstore.JobStoreSupport triggerFired
SEVERE: Error retrieving job, setting trigger state to ERROR.
org.quartz.JobPersistenceException: Couldn't retrieve job because a required class was not found: bgoc.dwgScheduler.dwg_QuartzAutoDownloadJob [See nested exception: java.lang.ClassNotFoundException: bgoc.dwgScheduler.dwg_QuartzAutoDownloadJob]**<br>

at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveJob(JobStoreSupport.java:1328)<br>
at org.quartz.impl.jdbcjobstore.JobStoreSupport.triggerFired(JobStoreSupport.java:2789)<br>
at org.quartz.impl.jdbcjobstore.JobStoreSupport$37.execute(JobStoreSupport.java:2757)<br>
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3662)<br>
at org.quartz.impl.jdbcjobstore.JobStoreSupport.triggerFired(JobStoreSupport.java:2751)<br>
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:313)<br>
Caused by: java.lang.ClassNotFoundException: bgoc.dwgScheduler.dwg_QuartzAutoDownloadJob <br>
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)<br>
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)<br>
at org.quartz.simpl.InitThreadContextClassLoadHelper.loadClass(InitThreadContextClassLoadHelper.java:74)<br>
at org.quartz.simpl.CascadingClassLoadHelper.loadClass(CascadingClassLoadHelper.java:118)<br>
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectJobDetail(StdJDBCDelegate.java:897)<br>
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveJob(JobStoreSupport.java:1316)<br>

我确定我的Java代码不是问题,因为此错误不会一直发生.但是,它的发生率高达30%,非常高.但是,我不确定我的石英文件是否正确写入.下面是编写的石英文件.

I am sure that my java code is not the problem because this error does not occur all the time. However, it has a 30% occurance rate which is quite high. However, i am not sure whether my quartz file is written correctly. Below is the quartz file written.

配置ThreadPool

配置JobStore

配置数据源

有人可以帮助我解决这个问题吗?如果您想了解更多信息,请发布,我会尽快提供.

Can anyone help me with this problem? If you would like to have more information please do post, I will provide it as soon as possible.

推荐答案

Classloader抱怨缺少类 bgoc.dwgScheduler.dwg_QuartzAutoDownloadJob .

Classloader complains about class bgoc.dwgScheduler.dwg_QuartzAutoDownloadJob missing.

这堂课是您的吗?您是否检查了此类是否在类路径上?

Is this class yours?Have you checked if this class is on the classpath ?

也许这个类不是必需的,但是其他一些类或配置可能正在导入它.

Maybe this class is not necessary, but some other class or configuration may be importing it.

这篇关于使用CronTrigger和MySQL进行调度程序时发生ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 03:12