title: java.lang.IllegalArgumentException: Some fields are missing (optional or mandatory)
body: <p>I am trying to create a fixedfile reader using Apache Camel Bindy but am getting exception.Please help me to find the solution.Without header and footer which is working well.</p>
  
  <p><strong>Update:</strong>
  File is small to understand now and public is added</p>
  
  <p><strong>File Content:</strong></p>
  
  <pre><code>101-08-2009
  30A9
  20A9
  60A9
  40A9
  10A9
  50A8
  9000000002
  </code></pre>
  
  <p><strong>New Exception:</strong></p>
  
  <pre><code>java.lang.IllegalArgumentException: Some fields are missing (optional or mandatory), line: 2
      at org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:295) ~[camel-bindy-2.19.1.jar:2.19.1]
      at org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.createModel(BindyFixedLengthDataFormat.java:294) ~[camel-bindy-2.19.1.jar:2.19.1]
  </code></pre>
  
  <p><strong>Exception:</strong></p>
  
  <pre><code>org.apache.camel.RuntimeCamelException: java.lang.IllegalAccessException: Class org.apache.camel.util.ObjectHelper can not access a member of class com.camel.examples.OrderHeader with modifiers ""
      at org.apache.camel.util.ObjectHelper.newInstance(ObjectHelper.java:1686) ~[camel-core-2.19.1.jar:2.19.1]
  </code></pre>
  
  <p><strong>Router:</strong></p>
  
  <pre><code>// @Override
      public void configure() throws Exception {
          Comparator&lt;Order&gt; comparator = new Comparator&lt;Order&gt;() {
              @Override
              public int compare(Order o1, Order o2) {
                  return o1.getOrderNr() - o2.getOrderNr();
              }
          };
  
         DataFormat bindy = new BindyFixedLengthDataFormat(Order.class);
          from("file:C:/Users/workspace/SampleProjects/in?delete=true")
                  .routeId("ValidateFile-Post2Q")
  
                  .unmarshal(bindy).split(body().sort(comparator));
  </code></pre>
  
  <p><strong>Model Java classes:</strong></p>
  
  <pre><code>    @FixedLengthRecord(length = 4, paddingChar = ' ', header = OrderHeader.class, footer = OrderFooter.class)
  public class Order {
  
      private @Link OrderHeader header;
      private @Link OrderFooter footer;
  
      @DataField(pos = 1, length = 2)
      private int orderNr;
  
      @DataField(pos = 3, length = 2)
      private String clientNr;
  
  
      @Override
      public String toString() {
          // TODO Auto-generated method stub
          return orderNr + clientNr + header + footer;
      }
  
      public OrderHeader getHeader() {
          return header;
      }
  
  
      public void setHeader(OrderHeader header) {
          this.header = header;
      }
  
  
      public OrderFooter getFooter() {
          return footer;
      }
  
  
      public void setFooter(OrderFooter footer) {
          this.footer = footer;
      }
  
      public int getOrderNr() {
          return orderNr;
      }
  
      public void setOrderNr(int orderNr) {
          this.orderNr = orderNr;
      }
  
      public String getClientNr() {
          return clientNr;
      }
  
      public void setClientNr(String clientNr) {
          this.clientNr = clientNr;
      }
  }
  
      @FixedLengthRecord
      public class OrderFooter {
  
          @DataField(pos = 1, length = 1)
          public int recordType ;
  
          @DataField(pos = 2, length = 9)
          public String numberOfRecordsInTheFile;
  
          public String toString() {
              return recordType + ":" + numberOfRecordsInTheFile;
          }
  
          public int getRecordType() {
              return recordType;
          }
  
          public void setRecordType(int recordType) {
              this.recordType = recordType;
          }
  
          public String getNumberOfRecordsInTheFile() {
              return numberOfRecordsInTheFile;
          }
  
          public void setNumberOfRecordsInTheFile(String numberOfRecordsInTheFile) {
              this.numberOfRecordsInTheFile = numberOfRecordsInTheFile;
          }   
      }
  
      @FixedLengthRecord
      public class OrderHeader {
          @DataField(pos = 1, length = 1)
          public int recordType = 1;
  
          @DataField(pos = 2, length = 10, pattern = "dd-MM-yyyy")
          public Date recordDate;
  
          public String toString() {
              return recordType + ":" + new SimpleDateFormat("dd-MM-yyyy").format(recordDate);
          }
  
          public int getRecordType() {
              return recordType;
          }
  
          public void setRecordType(int recordType) {
              this.recordType = recordType;
          }
  
          public Date getRecordDate() {
              return recordDate;
          }
  
          public void setRecordDate(Date recordDate) {
              this.recordDate = recordDate;
          }
      }
  </code></pre>
  
  <p><strong>Dependencies:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;gs-spring-boot&lt;/artifactId&gt;
      &lt;version&gt;0.1.0&lt;/version&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.5.8.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-spring-boot-starter&lt;/artifactId&gt;
              &lt;version&gt;2.19.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Camel xquery support --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-saxon&lt;/artifactId&gt;
              &lt;version&gt;2.19.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Camel JMS support and ActiveMq --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-jms&lt;/artifactId&gt;
              &lt;version&gt;2.19.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.activemq&lt;/groupId&gt;
              &lt;artifactId&gt;activemq-camel&lt;/artifactId&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.apache.activemq&lt;/groupId&gt;
                      &lt;artifactId&gt;activemq-broker&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-ftp&lt;/artifactId&gt;
              &lt;version&gt;2.19.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-bindy&lt;/artifactId&gt;
              &lt;version&gt;2.19.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-stream&lt;/artifactId&gt;
              &lt;version&gt;2.19.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-restlet&lt;/artifactId&gt;
              &lt;version&gt;2.19.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-flatpack&lt;/artifactId&gt;
              &lt;version&gt;2.19.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Hawtio dependency - a lightweight web console to monitor and manage 
              application --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.hawt&lt;/groupId&gt;
              &lt;artifactId&gt;hawtio-springboot&lt;/artifactId&gt;
              &lt;version&gt;1.5.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.hawt&lt;/groupId&gt;
              &lt;artifactId&gt;hawtio-core&lt;/artifactId&gt;
              &lt;version&gt;1.5.2&lt;/version&gt;
          &lt;/dependency&gt;
  
  
  
      &lt;/dependencies&gt;
  
      &lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
  
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>