ERROR org.quartz.core.JobRunShell - Job group1.JobReport threw an unhandled Exception -
there strange problem when generating report using quartz scheduler
i can generate report fine! no problem.
the method (reportsbean) works normally, there problem when passing through quartz
any idea please?? don't know anymore :/
13449 [myscheduler_worker-1] error org.quartz.core.jobrunshell - job group1.jobreport threw unhandled exception: java.lang.nullpointerexception @ com.changes.bean.reportsbean.createpdfcriticalchanges(reportsbean.java:104) @ com.changes.quartz.jobreport.execute(jobreport.java:36) @ org.quartz.core.jobrunshell.run(jobrunshell.java:202) @ org.quartz.simpl.simplethreadpool$workerthread.run(simplethreadpool.java:573) 13452 [myscheduler_worker-1] error org.quartz.core.errorlogger - job (group1.jobreport threw exception. org.quartz.schedulerexception: job threw unhandled exception. [see nested exception: java.lang.nullpointerexception] @ org.quartz.core.jobrunshell.run(jobrunshell.java:213) @ org.quartz.simpl.simplethreadpool$workerthread.run(simplethreadpool.java:573) caused by: java.lang.nullpointerexception @ com.changes.bean.reportsbean.createpdfcriticalchanges(reportsbean.java:104) @ com.changes.quartz.jobreport.execute(jobreport.java:36) @ org.quartz.core.jobrunshell.run(jobrunshell.java:202)
reportsbean
public class jobreport implements job { public void execute(jobexecutioncontext context) throws jobexecutionexception { //basicconfigurator.configure(); try { reportsbean reportsbean = new reportsbean(); reportsbean.createpdfcriticalchanges(); simpledateformat dateformat = new simpledateformat("dd/mm/yyyy – hh:mm:ss"); system.out.println("rodou: " + dateformat.format( new date() )); } catch (jrexception | sqlexception e) { e.printstacktrace(); } } }
quartz.properties
org.quartz.scheduler.instancename = myscheduler org.quartz.threadpool.threadcount = 3 org.quartz.jobstore.class = org.quartz.simpl.ramjobstore org.quartz.plugin.jobinitializer.class =org.quartz.plugins.xml.xmlschedulingdataprocessorplugin org.quartz.plugin.jobinitializer.filenames = com/changes/quartz/quartz-config.xml org.quartz.plugin.jobinitializer.failonfilenotfound = true
web.xml
<!-- inicio quartz --> <servlet> <servlet-name>quartzservlet</servlet-name> <servlet-class>com.changes.quartz.servlet.quartzservlet</servlet-class> </servlet> <servlet> <servlet-name>quartzinitializer</servlet-name> <servlet-class>org.quartz.ee.servlet.quartzinitializerservlet</servlet-class> <init-param> <param-name>config-file</param-name> <param-value>quartz.properties</param-value> </init-param> <init-param> <param-name>shutdown-on-unload</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>start-scheduler-on-load</param-name> <param-value>true</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <!-- fim quartz -->
the problem have nullpointerexception in reportsbean.
since signature of quartz execute method is
public void execute(jobexecutioncontext context) throws jobexecutionexception
quartz can deal jobexecutionexception's thrown within method. in case gets unexpected nullpointerexception.
to solve problem should remove cause of nullpointer. sourcecode above couldnt figure out cause of exception since occurs within reportsbean.
certainly method reportsbean.createpdfcriticalchanges trys access uninitialized member.
Comments
Post a Comment