Exeception thrown whilst executing asynchronous call
thiagu.m Nov 2, 2011 2:19 PMHi,
In my project ear have two war files.The war file one has seam.quartz.properties file from WEB-INF/classes folder.This propertie file has following configuration.
org.quartz.scheduler.instanceName = Sched1 org.quartz.scheduler.instanceId = 1 org.quartz.scheduler.rmi.export = false org.quartz.scheduler.rmi.proxy = false org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 3 org.quartz.jobStore.misfireThreshold 60000 org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
The war file one has following line in the components.xml from WEB-INF folder.
<async:quartz-dispatcher/>
The war file one has following two seam components classes from WEB-INF/classes folder.
@Name("controller")
@Scope(APPLICATION)
@AutoCreate
@Startup
public class ScheduleController {
@In
ScheduleProcessor processor;
private QuartzTriggerHandle quartzTestTriggerHandle;
private static String CRON_INTERVAL = "0 * * * * ?";
@Create
public void scheduleTimer() {
quartzTestTriggerHandle =
processor.initProcess(new Date(), CRON_INTERVAL);
}
}
and
@Name("processor")
@AutoCreate
public class ScheduleProcessor {
@Asynchronous
@Transactional
public QuartzTriggerHandle initProcess(
@Expiration Date when, @IntervalCron String interval) {
System.out.println("___________________"+new Date());
return null;
}
}
The ear/lib folder has quartz.jar file.When I deploy my ear project I am getting the null pointer exception after every minute.
java.lang.NullPointerException at org.jboss.seam.async.AsynchronousInvocation$1.process(AsynchronousInvocation.java:55) at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:80) at org.jboss.seam.async.AsynchronousInvocation.execute(AsynchronousInvocation.java:44) at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:243) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
this exception because of Component.getInstance(processor
) returns null value.
This line is from AsynchronousInvocation.java:50.
any one help me how to resolve this issue..