java - quartz integration with spring,null pointer exception -


i trying integrate quartz spring, file location passed jobcsvfile class jsp page not taking location , showing null pointer exception. , want shedule timing jsp page dont know how dothat since using trigurring details in applicationcontext.xml
applicationcontext.xml

<bean id="jobcsvfile"     class="com.vxl.appanalytix.dataload.quartz.jobcsvfile">  </bean> <bean id="joba" class="org.springframework.scheduling.quartz.jobdetailbean"> <property name="jobclass" value="com.vxl.appanalytix.dataload.quartz.jobcsvfile" /> <property name="jobdataasmap">     <map>         <entry key="timeout" value="5" />     </map> </property> </bean> <bean id="crontriggerjoba"     class="org.springframework.scheduling.quartz.crontriggerbean">  <property name="jobdetail" ref="joba" /> <property name="cronexpression" value="0/5 * * * * ?" /> </bean> <bean class="org.springframework.scheduling.quartz.schedulerfactorybean"> <property name="jobdetails">     <list>         <ref bean="joba" />     </list> </property> <property name="triggers">     <list>         <ref bean="crontriggerjoba" />      </list> </property> </bean> 

with out sheduling in applicationcontext.xml can in other way?

i can show have done, use java not jsp (i don't know jsp)

first created job interface:

public interface jobi {     void execute(object[] args); } 

i needed have same executable method each job

then create job , beanify it

public class simplejob implements jobi {     @override     public void execute(object[] args) {         (object o : args) {             // string[] array = o.tostring().split("=");             system.out.println(o.tostring());         }     } } 

// context file

<bean id="simplejob" class="uk.co.utel.tcds.system.schedule.jobs.simplejob" /> 

now create class adding new jobs ie jobcontroller

   public jobcontroller{     private final stdscheduler scheduler;      public jobcontroller(stdscheduler scheduler){         this.scheduler=scheduler;         }      public void addjob(string cronexpr){         crontrigger trigger = new crontrigger("name","group");         trigger.setcronexpression(cronexpr));         scheduler.schedulejob(getjobdetails(), trigger);         }      public jobdetails getjobdetails(){         final jobi jobbean = (jobi) applicationcontext.getbean("simplejob");         final methodinvokingjobdetailfactorybean jobdetail = new methodinvokingjobdetailfactorybean();         jobdetail.settargetobject(jobbean);         jobdetail.settargetmethod("execute");         jobdetail.setname("name");         jobdetail.setgroup("group");         return (jobdetail) jobdetail.getobject();         }     } 

// context file

  <bean id="jobcontroller" class="jobcontroller">         <constructor-arg name="scheduler" ref="scheduler" />     </bean> 

all need add id scheduler

<bean id="scheduler"         class="org.springframework.scheduling.quartz.schedulerfactorybean">         ..... </bean> 

now when want use jsp, need pass jobcontroller bean script , call addjob method

and right, forgot, in different version of quartz might different way create jobdetail , trigger objects


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -