java.lang.ClassNotFoundException
when Using CronTrigger and MySQL to do scheduler in Java
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>
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.
org.quartz.scheduler.instanceName = DefaultQuartzScheduler
org.quartz.scheduler.instanceId = one
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 5
org.quartz.threadPool.threadPriority = 4
org.quartz.jobStore.misfireThreshold = 5000
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.dataSource.myDS.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.myDS.URL = jdbc:mysql://localhost:3307/QRTZ_BIS
org.quartz.dataSource.myDS.user = root
org.quartz.dataSource.myDS.password = password
org.quartz.dataSource.myDS.maxConnections 5
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 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.