Announcement Announcement Module
Collapse
No announcement yet.
LineTokenizer error Version 2.0 RC1 - Error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • LineTokenizer error Version 2.0 RC1 - Error

    I am getting following error when I try to tweak and run compositeItemWriterSampleJob, dont know what is wrong here.... as mentioned below in my linetokenizer, I am setting the ranges correctly

    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'step1': Cannot resolve reference to bean 'fileItemReader' while setting bean property 'itemReader'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileItemReader' defined in class path resource [jobs/compositeItemWriterSampleJob.xml]: Cannot create inner bean 'org.springframework.batch.item.file.mapping.DefaultLineMapper#1113622' of type [org.springframework.batch.item.file.mapping.DefaultLineMapper] while setting bean property 'lineMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.batch.item.file.mapping.DefaultLineMapper#1113622' defined in class path resource [jobs/compositeItemWriterSampleJob.xml]: Cannot resolve reference to bean 'fixedFileTokenizer' while setting bean property 'lineTokenizer'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fixedFileTokenizer' defined in class path resource [jobs/compositeItemWriterSampleJob.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.springframework.batch.item.file.transform.Range[]] for property 'columns'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [org.springframework.batch.item.file.transform.Range] for property 'columns[0]': no matching editors or conversion strategy found
    This is how my line tokenizer is:

    Code:
    <beans:bean id="fileItemReader"
    		class="org.springframework.batch.item.file.FlatFileItemReader">
    		<beans:property name="resource"
    			value="./data/myfile.txt" />
    		<beans:property name="lineMapper">
    			<beans:bean
    				class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
    				<beans:property name="lineTokenizer" 
    					ref="fixedFileTokenizer" />
    				<beans:property name="fieldSetMapper"
    					ref="fieldSetMapper" />
    			</beans:bean>
    		</beans:property>
    	</beans:bean>
    
    <beans:bean id="fixedFileTokenizer"
    		class="org.springframework.batch.item.file.transform.FixedLengthTokenizer">
    		<beans:property name="strict" value="false" />
    		<beans:property name="columns"
    				value=" 1-3,4,5-6,7-8,9, 
    				10-16,17-18,19-20,21-22,23-29,
    				30,31,32,33,34-41,
    				42-43,44-45,46-47,48-49,50,
    				51,52,53,54-55,56-61, 
    				62-66,67,68,69,70, 
    				71-72,73-74,75-76,77-78,79-80,
    				81,113,122,123-150">
    		</beans:property>
    	</beans:bean>

  • #2
    You're missing the range property editor:

    Code:
      <bean id="customEditorConfigurer" 
            class="org.springframework.beans.factory.config.CustomEditorConfigurer">
        <property name="customEditors">
          <map>
            <entry key="org.springframework.batch.item.file.transform.Range[]">
              <bean class="org.springframework.batch.item.file.transform.RangeArrayPropertyEditor" />
            </entry>
          </map>
        </property>
      </bean>

    Comment


    • #3
      Thanks Lucasward!
      Now here is my confusion, in 1.x we had a concept of job launcher which comprised of all the details about the job including repositories etc.

      I looked at the 2.x spec and it seems we do not need job launcher anymore and run the job by following command:
      bash$ java CommandLineJobRunner endOfDayJob.xml endOfDay schedule.date(date)=2008/01/01

      I can see the range property editor being imported from commoncontext.xml in my simple-job-launcher-context.xml, but I cant connect or figure out on how the job actually gets this launcher information, as there is nothing specified in the job.

      In other words, how does CommandLineJobRunner know which context xml file needs to be used.?

      Comment

      Working...
      X