Results 1 to 2 of 2

Thread: Late-binding issue with Spring 3.0.x versus 2.5.6

  1. #1
    Join Date
    Dec 2010
    Posts
    19

    Default Late-binding issue with Spring 3.0.x versus 2.5.6

    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:
    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)
    I know there have already been some threads on topic like this here but I couldn't find anything relevant to my scenario.

    Any help would be appreciated. Thanks.

  2. #2
    Join Date
    Dec 2010
    Posts
    19

    Default

    I think I have narrowed it down. The issue is not any specific version of Spring or SpringBatch but instead the mixture of using different versions of Spring modules.

    What I mean to say here is that if there is any mismatch between spring-aop/context/core version with what SpringBatch's dependency is referring to internally then we will this error.

    We need to make sure that we are using the same version for above-mentioned spring modules everywhere i.e. from within SpringBatch and out of it (if we are explicitly specifying dependency for those Spring modules as well)

    I hope I am making sense here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •