I am trying to get the MultiResourceItemReader working and having some problems applying it...
Here is the configuration for it (the input files sit in an "inputs" directory within the run directory):
but on execution I get:Code:<bean id="multiFileItemReader" class="org.springframework.batch.item.file.MultiResourceItemReader" scope="step"> <property name="resources" value="file:#{stepExecutionContext.fileName}/*.dat" /> <property name="delegate" ref="itemReader" /> </bean> <bean id="itemReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step"> <property name="lineMapper" ref="lineMapper" /> </bean>
Also, if I might ask... which is the appropriate TaskExecutor to be using for the configuration proposed in section 7.4 of the docs http://static.springsource.org/sprin...alability.html?Code:2009-02-23 17:45:14,485 [taskExecutor-1] WARN org.springframework.batch.item.file.MultiResourceItemReader No resources to read 2009-02-23 17:45:14,509 [taskExecutor-1] ERROR org.springframework.batch.core.step.AbstractStep Exception while closing step execution resources org.springframework.batch.item.ItemStreamException: Error while closing item reader at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.close(AbstractItemCountingItemStreamItemReader.java:94) at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy9.close(Unknown Source) at org.springframework.batch.item.file.MultiResourceItemReader.close(MultiResourceItemReader.java:130) at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy6.close(Unknown Source) at org.springframework.batch.item.support.CompositeItemStream.close(CompositeItemStream.java:86) at org.springframework.batch.core.step.tasklet.TaskletStep.close(TaskletStep.java:331) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:245) at org.springframework.batch.core.partition.support.TaskExecutorPartitionHandler$1.call(TaskExecutorPartitionHandler.java:108) at org.springframework.batch.core.partition.support.TaskExecutorPartitionHandler$1.call(TaskExecutorPartitionHandler.java:107) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:636) Caused by: java.lang.NullPointerException at org.springframework.batch.item.file.FlatFileItemReader.doClose(FlatFileItemReader.java:214) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.close(AbstractItemCountingItemStreamItemReader.java:91) ... 33 more
org.springframework.core.task.SimpleAsyncTaskExecu tor
or
org.springframework.scheduling.concurrent.ThreadPo olTaskExecutor
Note: I am using local threads.
Thanks.
Keith


Reply With Quote