title: Unmarshalling list of objects using castor gives java.lang.IllegalArgumentException: object is not an instance of declaring class
body: <p>I'm using castor 1.3.3-rc1 and I've been puzzled with this problem. Have read the manuals few times and I believe I've done everything right here, but I keep getting :</p>
  
  <pre><code>java.lang.IllegalArgumentException: object is not an instance of declaring class{File: [not available]; line: 4; column: 43}
  </code></pre>
  
  <p>when unmarshalling my xml.</p>
  
  <p>These are my java classes:</p>
  
  <pre><code>public class ReportConfiguration {
      private List&lt;ColumnMapping&gt; columnMappings;
  
      // getters and setters omitted
  }
  
  public class ColumnMapping {
      private int index;
      private String label;
      private String sumTotal;
  
      // getters and setters omitted
  }
  </code></pre>
  
  <p>This is my xml data file which will be unmarshalled into java classes above</p>
  
  <pre><code>&lt;reportConfiguration&gt;
      &lt;columnMappings&gt;
          &lt;columnMapping index="0" label="Login"/&gt;
          &lt;columnMapping index="1" label="Group"/&gt;
          &lt;columnMapping index="2" label="Profit" sumTotal="yes"/&gt;
      &lt;/columnMappings&gt;
  &lt;/reportConfiguration&gt;
  </code></pre>
  
  <p>And this is my castor mapping file</p>
  
  <pre><code>&lt;mapping&gt;
      &lt;class name="my.company.ReportConfiguration"&gt;
          &lt;map-to xml="reportConfiguration"/&gt;
          &lt;field name="columnMappings" collection="arraylist" type="my.company.ColumnMapping"&gt;
              &lt;bind-xml name="columnMappings"/&gt;
          &lt;/field&gt;
      &lt;/class&gt;
  
      &lt;class name="my.company.ColumnMapping"&gt;
          &lt;map-to xml="columnMapping"/&gt;
          &lt;field name="index" type="integer" required="true"&gt;
              &lt;bind-xml name="index" node="attribute"/&gt;
          &lt;/field&gt;
          &lt;field name="label" type="string" required="true"&gt;
              &lt;bind-xml name="label" node="attribute"/&gt;
          &lt;/field&gt;
          &lt;field name="sumTotal" type="string"&gt;
              &lt;bind-xml name="sumTotal" node="attribute"/&gt;
          &lt;/field&gt;
      &lt;/class&gt;
  &lt;/mapping&gt;
  </code></pre>
  
  <p>I used Spring OXM, created a org.springframework.oxm.castor.CastorMarshaller instance on my application context, and injected an Unmarshaller instance as dependency. When unmarshalling I just do something like this:</p>
  
  <pre><code>ReportConfiguration config = (ReportConfiguration) unmarshaller.unmarshall(new StreamSource(inputStream));
  </code></pre>
  
  <p>Can anyone spot what did I do wrong / how else I can debug this problem ?</p>