Announcement Announcement Module
Collapse
No announcement yet.
problem while passing the flat file name as job parameter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem while passing the flat file name as job parameter

    Hi,
    I am having trouble passing the flat file name as parameter to my job
    I tried to use StepExecutionResourceProxy
    and failed with the exception


    I tried to use StepExecutionResourceProxy
    and failed with the exception
    java.lang.IllegalStateException: Resource must exist: [org.springframework.batch.core.resource.StepExecut ionResourceProxy@b4be3d]
    at org.springframework.util.Assert.state(Assert.java: 384)
    at org.springframework.batch.item.file.FlatFileItemRe ader.open(FlatFileItemReader.java:109)
    at org.springframework.batch.item.support.CompositeIt emStream.open(CompositeItemStream.java:105)
    at org.springframework.batch.core.step.item.ItemOrien tedStep.execute(ItemOrientedStep.java:264)
    at org.springframework.batch.core.job.SimpleJob.execu te(SimpleJob.java:125)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:86)
    at org.springframework.core.task.SyncTaskExecutor.exe cute(SyncTaskExecutor.java:49)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher.run(SimpleJobLauncher.java:81)
    at com.wirecard.hermes.batch.job.Mt940JobTest.runJob( Mt940JobTest.java:66)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at org.junit.internal.runners.TestMethod.invoke(TestM ethod.java:59)
    at org.junit.internal.runners.MethodRoadie.runTestMet hod(MethodRoadie.java:98)
    at org.junit.internal.runners.MethodRoadie$2.run(Meth odRoadie.java:79)
    at org.junit.internal.runners.MethodRoadie.runBefores ThenTestThenAfters(MethodRoadie.java:87)
    at org.junit.internal.runners.MethodRoadie.runTest(Me thodRoadie.java:77)
    at org.junit.internal.runners.MethodRoadie.run(Method Roadie.java:42)
    at org.junit.internal.runners.JUnit4ClassRunner.invok eTestMethod(JUnit4ClassRunner.java:88)
    at org.junit.internal.runners.JUnit4ClassRunner.runMe thods(JUnit4ClassRunner.java:51)
    at org.junit.internal.runners.JUnit4ClassRunner$1.run (JUnit4ClassRunner.java:44)
    at org.junit.internal.runners.ClassRoadie.runUnprotec ted(ClassRoadie.java:27)
    at org.junit.internal.runners.ClassRoadie.runProtecte d(ClassRoadie.java:37)
    at org.junit.internal.runners.JUnit4ClassRunner.run(J Unit4ClassRunner.java:42)
    at com.intellij.rt.junit4.Junit4ClassSuite.run(Junit4 ClassSuite.java:85)
    at com.intellij.rt.execution.junit.JUnitStarter.main( JUnitStarter.java:40)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at com.intellij.rt.execution.application.AppMain.main (AppMain.java:90)

    What am I doing wrong here?
    Can any one of you provide an example?
    Any help is appreciated.

    please find the configuration below

    <bean id="mt940ImportJob" parent="simpleJob">
    <property name="steps">
    <bean id="step1" parent="simpleStep">
    <property name="streams">
    <list>
    <ref bean="fileItemReader"/>
    <ref bean="fileItemWriter"/>
    </list>
    </property>
    <property name="itemReader">
    <bean class="org.springframework.batch.item.support.Dele gatingItemReader">
    <property name="itemReader">
    <bean id="mt940reader" class="com.wirecard.hermes.batch.io.file.reader.Mt 940Reader">
    <property name="itemReader" ref="fileItemReader"/>
    <property name="referenceMapper" ref="referenceRecordMapper"/>
    </bean>
    </property>
    </bean>
    </property>
    <property name="itemWriter">
    <bean
    class="com.wirecard.hermes.batch.io.file.writer.Mt 940Writer" p:dao-ref="mt940Dao">
    </bean>
    </property>
    <property name="listeners" ref="inputFile"/>
    </bean>
    </property>
    </bean>

    <bean id="fileItemReader"
    class="org.springframework.batch.item.file.FlatFil eItemReader">
    <property name="resource" ref = "inputFile"/>
    <property name="lineTokenizer" ref="mt940Descriptor"/>
    <property name="fieldSetMapper">
    <bean class="org.springframework.batch.item.file.mapping .PassThroughFieldSetMapper"/>
    </property>
    </bean>
    <bean id="inputFile"
    class="org.springframework.batch.core.resource.Ste pExecutionResourceProxy">
    <property name="filePattern" value="%input.file.name%"/>
    </bean>

  • #2
    You can try using the latest trunk version and you should get a more informative exception (containing actual path to the resource that does not exist)

    Comment

    Working...
    X