Announcement Announcement Module
No announcement yet.
Late binding not working Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Late binding not working

    I'm using Spring 2.5.6 and Spring Batch 2.0.0.RC1.

    I'm configuring my jobs with the ClasspathXmlJobRegistry:

    <bean id="jobLocator" class="">
          <property name="jobPaths">
    In the config files for the jobs, I have this configured for my job/reader:

    <bean id="uploadReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step">
        <property name="saveState" value="true"/>
        <property name="resource" value="#{jobParameters[]}"/>
        <property name="lineMapper" ref="edfLineMapper"/>
        <property name="linesToSkip" value="1"/> <!-- first line is header -->
      <bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
        <property name="scopes">
            <entry key="step">
              <bean class="org.springframework.batch.core.scope.StepScope" />
    However, when I try to run the job, I get this:

    2009-03-06 09:49:56,194 WARN [FlatFileItemReader] (SimpleAsyncTaskExecutor-1 Input resource does not exist class path resource [#{jobParameters[]}]
    But the log from running my job shows:
    2009-03-06 09:49:55,830 DEBUG [BatchDeviceProcessingHelperImpl] (http- Launching job EdfDelayedProvisioning with parameters {BATCH_UPLOAD_HISTORY_ID=5,}
    Any ideas why this config is not working correctly?

  • #2

    I think it was an ID10T error..


    • #3
      Hi chudak, I seem to have the same problem, could you shed some light on why it is an ID1OT error?

          <bean id="portfolioCheckSearchReader" class="">
              <property name="lineMapper">
                  <bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
                      <property name="lineTokenizer">
                          <bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
                              <property name="delimiter" value=";"/>
                              <property name="names" value="CustomerID,Name,Owner,CVRNumber,BirthDate,Address,PostalCode,CityName,Type" />
                      <property name="fieldSetMapper" ref="portfolioFieldSetMapper"/>
              <property name="resource" value="classpath:./data/booking-#{jobParameters[bookingId]}.txt" />

      I seem to have the jobParameter set properly:
      JobExecution: id=0, startTime=Mon Mar 23 10:34:29 CET 2009, endTime=null, lastUpdated=Mon Mar 23 10:34:29 CET 2009, status=STARTED, exitStatus=exitCode=UNKNOWN;exitDescription=, job=[JobInstance: id=0, JobParameters=[{bookingId=testBookingId}], Job=[portfolioCheckJob]]
      But the resource isn't evaluated:
      2009-03-23 10:44:16,815 WARN [org.springframework.batch.item.file.FlatFileItemRe ader] - <Input resource does not exist class path resource [data/booking-#{jobParameters[bookingId]}.txt]>
      If i use a hardcoded value it works:
      <property name="resource" value="classpath:./data/booking-testBookingId.txt" />


      • #4
        I think the log you show is just a warning from the item reader to say that the file does not exist before the name is bound. Your reader is not working because it is not scope="step" (which chudak's was so his worked).


        • #5
          Ah, yes i should have noticed that in the documentation.

          Thank you.