title: Drools - Error creating field accessor for TypeDeclaration
body: <p>I created a simple project using Drools and Java basing on <a href="http://www.tutorialspoint.com/drools/drools_sample_drools_program.htm" rel="nofollow noreferrer">this tutorial</a>. It worked perfectly, so I adapted it to what I wanted to do. My DRL files use mvel dialect (instead of Java dialect) and initializing takes place in rule "initial" inside DRL file. You can see this project (source code as well as libraries and DRL file) <a href="https://bitbucket.org/pm_rulesengines/drools_desktop/src" rel="nofollow noreferrer">here</a>. My DRL file looks more less like the following:</p>
  
  
  
  <pre class="lang-css prettyprint-override"><code>package omd
  dialect "mvel"
  declare ocenaKwalifikacji
      value : Double
  end
  declare ocenaKandydata
      value : Double
  end
  declare ocenaTestow
      value : Double
  end
  declare ocenaRozmowy
      value : Double
  end
  
  rule "ocenakandydata/1 "
  when
  $ocenaRozmowy : ocenaRozmowy(value==5.0000)
  $ocenaKwalifikacji : ocenaKwalifikacji(value==5.0000)
  $ocenaTestow : ocenaTestow(value==5.0000)
  then
    insert(new ocenaKandydata (5.0000))
    System.out.println("ocenaKandydata setting to 5.0000)");
  end
  rule "ocenakandydata/2 "
  when
  $ocenaRozmowy : ocenaRozmowy(value==5.0000)
  $ocenaKwalifikacji : ocenaKwalifikacji(value==4.0000)
  $ocenaTestow : ocenaTestow(value==5.0000)
  then
    insert(new ocenaKandydata (5.0000))
    System.out.println("ocenaKandydata setting to 5.0000)");
  end
  
  ...
  
  rule "ocenakandydata/64 "
  when
  $ocenaRozmowy : ocenaRozmowy(value==2.0000)
  $ocenaKwalifikacji : ocenaKwalifikacji(value==2.0000)
  $ocenaTestow : ocenaTestow(value==2.0000)
  then
    insert(new ocenaKandydata (2.0000))
    System.out.println("ocenaKandydata setting to 2.0000)");
  end
  
  rule "initial"
  when
  then
  /*DATA*/
  insert(new ocenaKwalifikacji(5.0));
      insert(new ocenaRozmowy(2.0));
      insert(new ocenaTestow(2.0));
  end
  </code></pre>
  
  
  
  <p>Everything works fine, but the package in the first line must be <code>omd</code> although all classes are in the <code>com.sample</code> package. When I changed the package name to <code>com.sample</code>, I got the following error:</p>
  
  <pre><code>Error creating field accessors for TypeDeclaration 'ocenaKandydata' for type 'ocenaKandydata'.
  </code></pre>
  
  <p><strong>And now there is all the fun...</strong></p>
  
  <p>I created similar project for Android. I used the same code, but the libraries come from <a href="https://github.com/jorgemfk/dr-drools-android-demo" rel="nofollow noreferrer">another example</a> (the previous ones did put classes in java.* or javax.* packages, which is not allowed while programming for Android). You can see this project <a href="https://bitbucket.org/pm_rulesengines/drools_android" rel="nofollow noreferrer">here</a>. I put the <code>psc-zatrudnienie-ocena_kandydata.drl</code> file in the smartphone storage under <code>/storage/emulated/0/drools/psc-zatrudnienie-ocena_kandydata.drl</code>. When the package in the DRL file is <code>pl.me.drools2tp</code> (the same as all classes in Android app are placed in), I get following errors (similar to those ones above):</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>Error creating field accessors for TypeDeclaration 'ocenaKwalifikacji' for type 'ocenaKwalifikacji'
  Error creating field accessors for TypeDeclaration 'ocenaKandydata' for type 'ocenaKandydata'
  Error creating field accessors for TypeDeclaration 'ocenaTestow' for type 'ocenaTestow'
  Error creating field accessors for TypeDeclaration 'ocenaRozmowy' for type 'ocenaRozmowy'</code></pre>
  </div>
  </div>
  </p>
  
  <p>and when I change the package name in DRL file to something another, the errors are as following:</p>
  
  
  
  <pre class="lang-css prettyprint-override"><code>Class 'ocenaKwalifikacji' not found for type declaration of 'ocenaKwalifikacji'
  Class 'ocenaKandydata' not found for type declaration of 'ocenaKandydata'
  Class 'ocenaTestow' not found for type declaration of 'ocenaTestow'
  Class 'ocenaRozmowy' not found for type declaration of 'ocenaRozmowy'
  </code></pre>
  
  <p>Could anybody give me some advice about this? What does exactly "field accessor for TypeDeclaration" mean? All the classes which are mentioned in <code>declare</code> part of the DRL file are also defined in Java, have <code>value</code> field and both getters and setters. The dekstop version uses Drools 5.3.0 (there is a huge sort of JAR files from <a href="http://download.jboss.org/drools/release/5.3.0.Final/" rel="nofollow noreferrer">http://download.jboss.org/drools/release/5.3.0.Final/</a> as it was said on TutorialsPoint site). There is also one question connected with mine: <a href="https://stackoverflow.com/questions/8646934/integration-of-drools-expert-system-with-android-projects">Integration of Drools (Expert System) with Android Projects</a></p>
  
  <p>I will be very grateful for some help, tips or examples.</p>
  
  <p>Best regards,
  Peter.</p>
  
  <p>BTW I use IntelliJ and Android Studio.</p>