title: IllegalStateException: Cannot convert value of type to required type
body: <p>Here's the error I'm receiving.</p>
  
  <pre><code>       Caused by: java.lang.IllegalStateException: Cannot convert value of type [code.ProductFieldSetMapper] to required type [org.springframework.batch.item.file.mapping.FieldSetMapper] for property 'FieldSetMapper': no matching editors or conversion strategy found
  at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:264)
  at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:450)
  ... 23 more
  </code></pre>
  
  <p>Here's my context file (FileReaderConfig.xml)</p>
  
  <pre><code>        &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:batch="http://www.springframework.org/schema/batch"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/batch
      http://www.springframework.org/schema/batch/spring-batch.xsd"&gt;
  
  &lt;bean id="reader" class="org.springframework.batch.item.file.FlatFileItemReader"&gt;
      &lt;property name="resource" value="file:./output.txt" /&gt;
      &lt;property name="linesToSkip" value="1" /&gt;
      &lt;property name="lineMapper"&gt;
          &lt;bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper"&gt;
              &lt;property name="lineTokenizer"&gt;
                  &lt;bean
                      class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer"&gt;
                      &lt;property name="names" value="PRODUCT_ID,NAME,DESCRIPTION,PRICE" /&gt;
                  &lt;/bean&gt;
              &lt;/property&gt;
              &lt;property name="fieldSetMapper"&gt;
                  &lt;bean class="code.ProductFieldSetMapper" /&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  &lt;job id="importProducts" xmlns="http://www.springframework.org/schema/batch"&gt;
      &lt;step id="readWriteProducts"&gt;
          &lt;tasklet&gt;
              &lt;chunk reader="reader" writer="writer" commit-interval="100" /&gt;
          &lt;/tasklet&gt;
      &lt;/step&gt;
  &lt;/job&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here's the interface (FieldSetMapper.java)
             package code;</p>
  
  <pre><code> import org.springframework.batch.item.file.transform.FieldSet;
   import org.springframework.validation.BindException;
  
   public interface FieldSetMapper&lt;T&gt; {
  T mapFieldSet(FieldSet fieldSet) throws BindException;
   }
  </code></pre>
  
  <p>Here's ProductFieldSetMapper.java</p>
  
  <pre><code> package code;
  
  import org.springframework.batch.item.file.transform.FieldSet;
  import org.springframework.validation.BindException;
  
  public class ProductFieldSetMapper implements FieldSetMapper&lt;Product&gt; {
  
  public Product mapFieldSet(FieldSet fieldSet) throws BindException {
      // TODO Auto-generated method stub
      Product product = new Product();
      product.setId(fieldSet.readString("PRODUCT_ID"));
      product.setName(fieldSet.readString("NAME"));
      product.setDescription(fieldSet.readString("DESCRIPTION"));
      product.setPrice(fieldSet.readBigDecimal("PRICE"));
      return product;
  }
  
  }
  </code></pre>
  
  <p>And here's the class that I'm running (Runner.java)
      package code;</p>
  
  <pre><code>import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
  import org.springframework.batch.item.file.transform.FieldSet;
  import org.springframework.beans.BeansException;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  import org.springframework.validation.BindException;
  
  public class Runner {
  
  public static void main(String[] args) throws BeansException, BindException {
      // TODO Auto-generated method stub
      Product product;
       ApplicationContext context = 
               new ClassPathXmlApplicationContext("FileReaderConfig.xml");
  
      ProductFieldSetMapper obj = (ProductFieldSetMapper) context.getBean("FieldSetMapper");
  
       product = (Product) obj.mapFieldSet((FieldSet)context.getBean("lineTokenizer"));
  
  System.out.println(product.getDescription() + ""+product.getId()+""+product.getName());
  
  
  }
  }
  </code></pre>
  
  <p>I don't see where (or why for that matter)my code is attempting to convert a ProductFieldSetMapper into a FieldSetMapper (which is just an interface, I understand that won't work).</p>
  
  <p>BTW, Product.java is a POJO with  variables and their respective setters and getters.</p>