title: Integrating KIE workbench from a Java application
body: <p>I'm trying to integrate Drools kie workbench with a Java application. I'm Using <code>jboss-as-7.1.1.Final</code> as my workbench. Here is the rule definition:</p>
  
  <pre><code>package adeveloperdairy.admission;
  rule "set isEligible"
  ruleflow-group "sample"
  lock-on-active true
  when
      $p : Student(gpa &gt; 2.0)
  then
      System.out.println("GPA is greater than 2..");
      $p.setEligible(true);
  end
  </code></pre>
  
  <p>Here is my Java code:</p>
  
  <pre><code>    String url = "http://localhost:8080/kie-wb-distribution-wars-6.2.0.Final-as7/maven2/adeveloperdiary/Admission/1.0/Admission-1.0.jar";
  
      String userpassword = "user4:456";
      KieServices ks = KieServices.Factory.get();
      KieRepository kr = ks.getRepository();
      HttpURLConnection http = (HttpURLConnection)new URL(url).openConnection();
      String authEnc = new Base64Encoder().encode(userpassword.getBytes());
      http.setRequestProperty("Authorization", "Basic "+ authEnc);
      InputStream is = http.getInputStream();
      KieModule kModule = kr.addKieModule(ks.getResources().newInputStreamResource(is));
  
      KieContainer kContainer = ks.newKieContainer(kModule.getReleaseId());
      System.out.println(kModule.getReleaseId().toString());
  
      KieBase kBase = kContainer.getKieBase();
      System.out.println(kBase.getKiePackages());
      System.out.println(kBase.getKiePackage("adeveloperdiary.admission").getRules());
      KieSession kSession = kBase.newKieSession();
  
      Student s = new Student();
      s.setName("Raj");
      s.setGpa(5.0f); 
      kSession.insert(s);
      kSession.fireAllRules();
  </code></pre>
  
  <p>Here is the Student POJO class:</p>
  
  <pre><code> package adeveloperdiary.admission;
  
   /**
   * This class was automatically generated by the data modeler tool.
   */
  
   public class Student implements java.io.Serializable
  {
  
   static final long serialVersionUID = 1L;
  
   private java.lang.String name;
   private java.lang.Float gpa;
   private java.lang.Boolean eligible;
  
   public Student()
   {
   }
  
   public java.lang.String getName()
   {
    return this.name;
   }
  
   public void setName(java.lang.String name)
   {
    this.name = name;
   }
  
   public java.lang.Float getGpa()
   {
    return this.gpa;
   }
  
   public void setGpa(java.lang.Float gpa)
   {
    this.gpa = gpa;
   }
  
   public java.lang.Boolean getEligible()
   {
    return this.eligible;
   }
  
   public void setEligible(java.lang.Boolean eligible)
   {
    this.eligible = eligible;
   }
  
   public Student(java.lang.String name, java.lang.Float gpa,
       java.lang.Boolean eligible)
   {
    this.name = name;
    this.gpa = gpa;
    this.eligible = eligible;
   }
  
  }
  </code></pre>
  
  <p>I'm able to get the Maven deployment - adeveloperdiary:Admission:1.0, package -  [Package name=adeveloperdiary.admission]
  as well as the rule - [Rule name=set isEligible, agendaGroup=MAIN, salience=0, no-loop=false].</p>
  
  <p>But it's not able to execute the rule. May be I'm missing something here.</p>