Results 1 to 3 of 3

Thread: How do i give a Line Tokenizer for a flatfileItemReader in Springbatch 2.0.

  1. #1
    Join Date
    Jul 2011
    Posts
    3

    Default How do i give a Line Tokenizer for a flatfileItemReader in Springbatch 2.0.

    Unable to give LineTokenizer.Please help



    <bean id="itemReader" class="org.springframework.batch.item.file.FlatFil eItemReader">
    <property name="resource" value="file:./hello.txt" />
    <property name="lineMapper" ref="lineMapper" />
    </bean>
    <bean id="lineMapper"
    class="org.springframework.batch.item.file.mapping .DefaultLineMapper">
    <property name="tokenizer" ref="tokenizer" />
    <property name="fieldSetMapper" ref="fieldSetMapper" />
    </bean>
    <bean id="tokenizer"
    class="org.springframework.batch.item.file.transfo rm.DelimitedLineTokenizer">
    <property name="delimiter" value="H"/>
    </bean>
    <bean id="fieldSetMapper"
    class="org.springframework.batch.item.file.mapping .PassThroughFieldSetMapper" />

  2. #2
    Join Date
    Aug 2009
    Location
    Colorado
    Posts
    26

    Default

    Please provide more information. Data, job, error, what you are trying to do ... etc.

  3. #3
    Join Date
    Jul 2011
    Posts
    3

    Default

    Am trying to read a flat file which is comma seperated using FlatFileItemReader with the above configuration and write it to another file by replacing commans with spaces.Below Error am getting with LineMapper as there is no LineTokenizer in the FlatfileItemReader 2.0

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'itemReader' defined in class path resource [springbatch.xml]: Cannot resolve reference to bean 'lineMapper' while setting bean property 'lineMapper'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'lineMapper' defined in class path resource [springbatch.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException : Invalid property 'tokenizer' of bean class [org.springframework.batch.item.file.mapping.Defaul tLineMapper]: No property 'tokenizer' found

Posting Permissions

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