File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Exception with Range - org.springframework.beans.TypeMismatchException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Exception with Range - org.springframework.beans.TypeMismatchException" Watch "Exception with Range - org.springframework.beans.TypeMismatchException" New topic

Exception with Range - org.springframework.beans.TypeMismatchException

Vis Deo
Ranch Hand

Joined: Jul 02, 2004
Posts: 41
I am trying to run Spring batch sample to read fixed length flat file
I am getting exception with Range definition
What can be changed in xml def?

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:

code snippet
ApplicationContext context=new ClassPathXmlApplicationContext(new String[]{"fixedLength.xml"});
BeanFactory factory=context;
FlatFileItemReader<CustomerCredit> itemReader = ((FlatFileItemReader<CustomerCredit>)factory.getBean("itemReader"));

This is xml definition
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
xmlns:aop="" xmlns:tx=""
xmlns:p="" xmlns:xsi=""

<bean id="itemReader" class="org.springframework.batch.item.file.FlatFileItemReader">
<property name="resource" value="data/iosample/input/fixedLength.txt" />
<property name="lineMapper">
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<property name="lineTokenizer">
<property name="names" value="name,credit" />
<property name="columns" value="1-9,10-11" /> </bean>
<property name="fieldSetMapper">
<property name="targetType"
value="" />

Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 607

Configuration looks ok. Can you provide more of the exception trace?

Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
I agree. Here's the link:
subject: Exception with Range - org.springframework.beans.TypeMismatchException
It's not a secret anymore!