I am using Spring 2.5 + Spring Batch 2.0.2. I am using MRIR for reading data from multiple files which are placed in working folder by steps executed before load step
When i am running above job i get following error -Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns:batch="http://www.springframework.org/schema/batch" 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" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"> <import resource="../../applicationcontext.xml" /> <import resource="F2DBeans.xml" /> <batch:job id="F2D" job-repository="simpleJobRepository" restartable="true"> <batch:step id="copyToStage" next="copyToProcess" parent="simpleStep"> <batch:tasklet ref="copyToStageTasklet" /> </batch:step> <batch:step id="copyToProcess" next="loadFile" parent="simpleStep"> <batch:tasklet ref="copyToProcessTasklet" /> </batch:step> <batch:step id="loadFile" next="moveToArchieve" parent="simpleStep"> <batch:tasklet transaction-manager="transactionManager"> <batch:chunk reader="itemReader" writer="consoleWritter" commit-interval="1" /> </batch:tasklet> </batch:step> <batch:step id="moveToArchieve" next="purgeStep" parent="simpleStep"> <batch:tasklet ref="moveToArchiveTasklet" /> </batch:step> <batch:step id="purgeStep" parent="simpleStep"> <batch:tasklet ref="purgeTasklet" /> </batch:step> </batch:job> <bean id="itemWriter" parent="databaseWriter"> <property name="statementId" value="${batchConfig.iBATIS.insertQuery}" /> </bean> <bean id="itemReader" class="org.springframework.batch.item.file.MultiResourceItemReader" scope="step"> <property name="resources" value="file:data/working/*" /> <property name="delegate" ref="fileReader" /> </bean> <bean id="consoleWritter" class="com.jpmc.cco.cdt.ConsoleWritter" /> <bean id="fileReader" class="org.springframework.batch.item.file.FlatFileItemReader"> <property name="lineMapper" ref="mapper" /> </bean> <bean id="mapper" class="org.springframework.batch.item.file.mapping.DefaultLineMapper"> <property name="lineTokenizer" ref="tokenizer" /> <property name="fieldSetMapper" ref="genricFieldSetMapper" /> </bean> <bean id="tokenizer" class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer"> <property name="delimiter" value="|" /> <property name="names" value="DATA,CARD_NB,OFR_ID" /> </bean> </beans>
If i remove the scope="step" MRIR defination, job runs successfully but do not load any file as when job is loaded the working folder is empty.Code:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'F2D': 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 [6]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#6': 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)#6': Cannot resolve reference to bean 'loadFile' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadFile': Initialization of bean failed; nested exception is java.lang.IllegalStateException: No Scope registered for scope 'step' at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at com.jpmc.cco.cdt.core.BatchMain.doWork(BatchMain.java:107) at com.chase.ccs.common.AbstractBatch.doWork(AbstractBatch.java:209) at com.chase.ccs.common.AbstractBatch.execute(AbstractBatch.java:93) at com.jpmc.cco.cdt.core.BatchMain.main(BatchMain.java:45)
Is it problem with jars I am using or there is issue with beans defination?


Reply With Quote