Hello,
I am trying to use late-binding with SpringBatch 2.1.7 (or earlier) and Spring 3.0.x but it is not working. When I switch to Spring 2.5.6, it seems to work fine.
My configuration is pretty straightforward and the are of problem is:
Code:<bean id="tpiAccumulatorOutboundWriter" scope="step" class="org.hphc.batch.tpi.accumulator.outbound.TPIAccumulatorOutboundFlatFileWriter"> <property name="resource" value="file:#{jobParameters['fileName']}"/> <property name="shouldDeleteIfExists" value="true" /> <property name="lineAggregator"> <bean class="org.hphc.batch.tpi.accumulator.outbound.TPIAccumulatorOutboundListLineAggregator"> <!-- Will change when we decide on the actual format --> <property name="format" value="%1$50S" /> </bean> </property> <!-- Can be separate classes as well, if required --> <property name="headerCallback" ref="tpiAccumulatorOutboundWriter" /> <property name="footerCallback" ref="tpiAccumulatorOutboundWriter"/> </bean>
value="file:#{jobParameters['fileName']}" is failing in case of Spring 3.0.x
I get:
I know there have already been some threads on topic like this here but I couldn't find anything relevant to my scenario.HTML Code:org.springframework.batch.item.ItemStreamException: Unable to create file: [C:\Code\Spring\TPIAccumulatorOutbound\implementation\TPIAccumulatorOutbound] at org.springframework.batch.item.util.FileUtils.setUpOutputFile(FileUtils.java:80) at org.springframework.batch.item.file.FlatFileItemWriter$OutputState.initializeBufferedWriter(FlatFileItemWriter.java:497) at org.springframework.batch.item.file.FlatFileItemWriter$OutputState.access$000(FlatFileItemWriter.java:354) at org.springframework.batch.item.file.FlatFileItemWriter.doOpen(FlatFileItemWriter.java:291) at org.springframework.batch.item.file.FlatFileItemWriter.open(FlatFileItemWriter.java:281) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) 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 $Proxy2.open(Unknown Source) at org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:98) at org.springframework.batch.core.step.tasklet.TaskletStep.open(TaskletStep.java:288) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:193) at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:115) at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61) at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60) at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124) at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:99) at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:281) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:114) at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:300) at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:464) Caused by: java.io.IOException: The system cannot find the path specified at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:850) at org.springframework.batch.item.util.FileUtils.setUpOutputFile(FileUtils.java:72)
Any help would be appreciated. Thanks.


Reply With Quote