I place a scheduler in a class that implements the Job interface, and when I create the class object in the code and run the application, it gives me an error like this: any help?
public class Chart extends ApplicationFrame implements Job{
//Main class
String imagepath=IASGlobal.APPLICATION_PATH;
XYDataset dataset= null;
public Chart(final String title) {
super(title);
final XYDataset dataset = createDataset();
final JFreeChart chart = createChart(dataset);
try{
final ChartRenderingInfo info = new ChartRenderingInfo
(new StandardEntityCollection());
final File file1 = new File("/home/iasf/workspace/iasf/WebContent/images/chart89.png");
ChartUtilities.saveChartAsPNG(file1, chart, 1200, 800, info);
}catch(Exception e){}
******************
then some code
******************
JFreeChart createChart(final XYDataset dataset) {
//somr code here
}
private XYDataset createDataset(){
//some code here
}
public void execute(JobExecutionContext arg0) throws JobExecutionException {
// TODO Auto-generated method stub
final Chart demo = new Chart("Time Series Demo 8");
demo.pack();
RefineryUtilities.centerFrameOnScreen(demo);
demo.setVisible(true);
System.out.println("im done with 10 mins..");
}
}
[ERROR] 04 Oct 04:56:00.046 PM DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.core.ErrorLogger]
An error occured instantiating job to be executed. job= 'ChrtScheduleUp.ChartScheduleJob'
org.quartz.SchedulerException: Problem instantiating class 'modules.images.Chart' [See nested exception: java.lang.InstantiationException: modules.images.Chart]
at org.quartz.simpl.SimpleJobFactory.newJob(SimpleJobFactory.java:57)
at org.quartz.core.JobRunShell.initialize(JobRunShell.java:132)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:358)
Caused by: java.lang.InstantiationException: modules.images.Chart
at java.lang.Class.newInstance0(Class.java:357)
at java.lang.Class.newInstance(Class.java:325)
at org.quartz.simpl.SimpleJobFactory.newJob(SimpleJobFactory.java:55)
... 2 more
[INFO] 04 Oct 04:56:00.050 PM DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.RAMJobStore]
All triggers of Job ChrtScheduleUp.ChartScheduleJob set to ERROR state.
So, I get this error, and I'm not sure how to handle this ... help?
source
share