title: Using Drools with Glassfish server
body: <p>I am trying to use simple drools rule  with my dynamic web app. I created my servlet and now trying to integrate my rule. But it gives me error at this line  </p>
  
  <pre><code> RuleBase ruleBase = RuleBaseFactory.newRuleBase();
  
  java.lang.NoSuchMethodError: org.drools.util.ChainedProperties.&lt;init&gt;(Ljava/lang/String;Ljava/lang/ClassLoader;Z)V
      at org.drools.RuleBaseConfiguration.init(RuleBaseConfiguration.java:395)
      at org.drools.RuleBaseConfiguration.&lt;init&gt;(RuleBaseConfiguration.java:251)
      at org.drools.common.AbstractRuleBase.&lt;init&gt;(AbstractRuleBase.java:147)
      at org.drools.reteoo.ReteooRuleBase.&lt;init&gt;(ReteooRuleBase.java:160)
      at org.drools.reteoo.ReteooRuleBase.&lt;init&gt;(ReteooRuleBase.java:137)
      at org.drools.RuleBaseFactory.newRuleBase(RuleBaseFactory.java:87)
      at org.drools.RuleBaseFactory.newRuleBase(RuleBaseFactory.java:75)
      at org.drools.RuleBaseFactory.newRuleBase(RuleBaseFactory.java:38)
      at server.HelloServlet.runRules(HelloServlet.java:148)
      at server.HelloServlet.NewRule(HelloServlet.java:181)
      at server.HelloServlet.doGet(HelloServlet.java:82)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
  </code></pre>
  
  <p>And Here my  Helloservlet.java class</p>
  
  <p>@WebServlet("/HelloServlet")
  public class HelloServlet extends HttpServlet {
      private static final long serialVersionUID = 1L;</p>
  
  <pre><code>@EJB HelloBean bean;
  
  @PersistenceUnit
  EntityManagerFactory emf;
  
  
  
  
  /**
   * @see HttpServlet#HttpServlet()
   */
  public HelloServlet() {
      super();
      // TODO Auto-generated constructor stub
  }
  
  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      PrintWriter out=response.getWriter();
      out.print("&lt;html&gt;&lt;body&gt;&lt;title&gt;servlet page&lt;/title&gt;");
      out.print("&lt;h1&gt; " +request.getServletPath() + "&lt;/h1&gt;");
      out.println("&lt;h2&gt;" + bean.sayHello("nabiyin") + "&lt;/h2&gt;");
  MyUser user=(MyUser)emf.createEntityManager().createQuery("select u from MyUser u").getResultList().get(0);
  
  try {
  NewRule();
  } catch (Exception e) {
      // TODO Auto-generated catch block
      System.out.println("HATAAAAA");
      e.printStackTrace();
  }
  
  
  
  
      out.print("age: " + user.getAge());
  
      if (user.getAge()&lt;23) {
          out.println("hello");
      }
  
      out.print("&lt;/html&gt;&lt;/body&gt;");
  }
  
  public void runRules(String[] rules, Object... facts)
  throws Exception
  {       
      RuleBase ruleBase = RuleBaseFactory.newRuleBase();
      PackageBuilder builder = new PackageBuilder();       
  
      for(String ruleFile : rules)
      {
          System.out.println("Loading file: "+ruleFile);
          builder.addPackageFromDrl(
                  new InputStreamReader(
                      this.getClass().getResourceAsStream(ruleFile)));
      }
  
      Package pkg = builder.getPackage();       
      ruleBase.addPackage(pkg);
  
      WorkingMemory workingMemory
          = ruleBase.newStatefulSession();   
  
      for(Object fact : facts)
      {
          System.out.println("Inserting fact: "+fact);
          workingMemory.insert(fact);
      }
  
      workingMemory.fireAllRules();
  }
  
  
  public  void NewRule()
  throws Exception
  {
      System.out.println("New rule started");
  
     Number n1=3 , n2=1, n3=4 , n4=1 ,n5=5; 
     new HelloServlet().runRules(
            new String[]{"model/NewRule.drl"},
              n1,n2,n3,n4,n5);
  
      System.out.println("New rule finisheds");
  }
  
  /**
   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      // TODO Auto-generated method stub
  }
  </code></pre>