Dear friends, I am trying to load my xml to job but is giving the error JobRepository is mandatory.
I saw an example of Dave Syer at https://fisheye.springsource.org/rdi...h?Csid=751&u&N on setting the properties of a step abstract, but in my case is a simple job with just one step , nothing sophisticated.
Below the stack trace of the error and the infrastructure used by my job
Do I know why this error is occurring to increase my JOB?
Now thanks.
Error:
JobCode:Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requesterElectronicInvoice': Cannot create inner bean '(inner bean)' of type [org.springframework.batch.core.job.flow.support.SimpleFlow] while setting bean property 'flow'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot create inner bean '(inner bean)' of type [org.springframework.batch.core.job.flow.support.StateTransition] while setting bean property 'stateTransitions' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot create inner bean '(inner bean)' of type [org.springframework.batch.core.job.flow.support.state.StepState] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'step1' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'step1': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: JobRepository is mandatory
Job LauncherCode:<beans:beans xmlns="http://www.springframework.org/schema/batch" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.0.xsd"> <beans:import resource="simple-job-launcher-context.xml" /> <job id="requesterElectronicInvoice" job-repository="jobRepository"> <step id="step1"> <tasklet transaction-manager="transactionManager"> <chunk reader="hibernateItemReader" processor="ProcessorRps" writer="itemWriter" commit-interval="10" /> </tasklet> </step> </job> <beans:bean id="ReaderInvoice" class="br.com.moip.jobs.rnf.ReaderInvoice"> <beans:property name="sessionFactory" ref="sessionFactory" /> </beans:bean> <beans:bean id="hibernateItemReader" class="org.springframework.batch.item.database.HibernateCursorItemReader"> <beans:property name="queryString" value="from PaymentUsed where status = 1"/> <beans:property name="sessionFactory" ref="sessionFactory" /> </beans:bean> <beans:bean id="ProcessorRps" class="br.com.moip.jobs.rnf.ProcessorInvoice"/> <beans:bean id="itemWriter" class="br.com.moip.jobs.rnf.WriterInvoice"> <beans:property name="sessionFactory" ref="sessionFactory" /> </beans:bean> </beans:beans>
Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <import resource="applicationContext-DAO.xml"/> <bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean" p:dataSource-ref="dataSource" p:transactionManager-ref="transactionManager"> </bean> <bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"> <property name="jobRepository" ref="jobRepository" /> </bean> <bean class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor"> <property name="jobRegistry" ref="jobRegistry"/> </bean> <bean id="mapJobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean" lazy-init="true" autowire-candidate="false" /> <bean id="jobOperator" class="org.springframework.batch.core.launch.support.SimpleJobOperator" p:jobLauncher-ref="jobLauncher" p:jobExplorer-ref="jobExplorer" p:jobRepository-ref="jobRepository" p:jobRegistry-ref="jobRegistry" /> <bean id="jobExplorer" class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean" p:dataSource-ref="dataSource" /> <bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry" /> </beans>


Reply With Quote