Hey guys,
I am having problems while registering spring batch job with SchedulerFactoryBean.
Here is my applicationContext.
The error that I am receiving is:Code:<?xml version="1.0" encoding="ISO-8859-1"?> <beans xmlns="http://www.springftrying to registerramework.org/schema/beans" xmlns:batch="http://www.springframework.org/schema/batch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" lazy-init="true"> <property name="dataSource" ref="dataSource" /> </bean> <bean name=”reader” class=”com.test.Reader” <bean name="processor" class="com.test.Processor" /> <bean name="writer" class="com.test.Writer"> <property name="dataSource" ref="dataSource" /> </bean> <batch:job id="testjob"> <batch:step id="testStep"> <batch:tasklet> <batch:chunk reader="reader" processor="processor" writer="writer" commit-interval="100" /> </batch:tasklet> </batch:step> </batch:job> <bean id="testJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean"> <property name="beanName" value="testjob" /> </bean> <bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"> <property name="jobRepository" ref="jobRepository" /> </bean> <bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"> <property name="transactionManager" ref="transactionManager" /> </bean> <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="sajCleanerJobDetail" /> <property name="cronExpression" value="0/5 * * * * ?" /> </bean> <bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="false"> <property name="triggers"> <list> <ref bean="cronTrigger" /> </list> </property> <property name="startupDelay" value="0" /> </bean> </beans>
As you can see I am creating my job using the tools provided by spring batch.2011-08-20 14:17:40 ErrorLogger [ERROR] An error occured instantiating job to be executed. job= 'DEFAULT.testJobDetail'
org.quartz.SchedulerException: Job instantiation failed [See nested exception: java.lang.NullPointerException]
at org.springframework.scheduling.quartz.AdaptableJob Factory.newJob(AdaptableJobFactory.java:41)
I tried to understand what I can do to register the job using quartz, but I did not find anything.
So do you know what I have to do to register a spring batch job in quartz scheduler with spring ?
I got the spring-batch samples, and there they created a class called "org.springframework.batch.sample.quartz.JobLaunch erDetails" that is registered in quarts to run the job. Do I really need to do that? I thought that spring had already implemented a tool to do that.


Reply With Quote