[Building Sakai] quartz, components and classloaders

Steve Swinsburg steve.swinsburg at gmail.com
Mon Apr 9 05:53:52 PDT 2012


I had a chat off list with Seth who had the same issue:

http://sakai-project-mail-list-archives.1343168.n2.nabble.com/Perplexing-jar-and-quot-NoClassDefFoundError-quot-problem-td2200499.html

Of note:

org.sakaiproject.component.app.scheduler.jobs.SpringJobBeanWrapper.execute(SpringJobBeanWrapper.java:72) 

The problem lies in that class. Quartz is 
executing the job in the wrong classloader, (in fact it's doing so in 
its classloader.) The wrapper should be changed to do something like 
the EB stuff does, e.g. 

------------- 
ClassLoader currentClassLoader = 
     Thread.currentThread().getContextClassLoader(); 
try { 
  ClassLoader newClassLoader = job.getClass().getClassLoader(); 
  Thread.currentThread().setContextClassLoader(newClassLoader); 
   job.execute(jobExecutionContext); 
} finally { 
  Thread.currentThread().setContextClassLoader(currentClassLoader); 
} 
------------- 


On 09/04/2012, at 9:38 PM, Steve Swinsburg wrote:

> Hi all,
> 
> I'm having an issue with a Quartz job which I have deployed into my impl jar and hence packaged and deployed into components. This particular job writes out a CSV file using OpenCSV. The OpenCSV jar is bundled in with the component, however when it runs it is throwing a class not found error for one of the OpenCSV classes.
> 
> The OpenCSV jar is bundled and I have verified it contains the class I need.
> 
> Moving the OpenCSV jar into shared/lib does the trick so I'm wondering if something has changed with Quartz and its visibility of classes when it runs jobs? 
> I am also using Tomcat 7 on trunk.
> 
> cheers,
> Steve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120409/aa896059/attachment.html 


More information about the sakai-dev mailing list