1 Reply Latest reply on Nov 29, 2012 2:56 PM by Jason Huang

    Had a runtime error on creating a rule agent

    Jason Huang Newbie

      Guvnor package version: guvnor-distribution-wars-5.3.0-jboss-as-6.0.war

      App server version: Jboss 6.1

       

      Hello,

      I am new on Drools guvnor. I was following a demo from youtube: http://www.youtube.com/watch?v=585tmSp5HXU to build rules in Guvnor and a client project to access rules in Guvnor. I was able to follow the steps to build, package and deploy the rules in guvnor(which resides in Jboss 6.1). When I ran the client project from Eclipse, I got the following NPE:

       

      http://localhost:8080/guvnor-distribution-wars-5.3.0-jboss-as-6.0/org.drools.guvnor.Guvnor/package/org.sample/TestSnapshot

      john

      john

       

       

       

       

       

       

       

       

       

       

      Here is my code snipet:

      Properties prop =

      new Properties();

       

      prop.load(

      new FileInputStream("Guvnor.properties"));

       

      System.

      out.println(prop.getProperty("url"));

      System.

      out.println(prop.getProperty("username"));

      System.

      out.println(prop.getProperty("password"));

       

       

      //RuleAgent ruleAgent = RuleAgent.newRuleAgent(prop);

       

       

      try

      {

      RuleAgent ruleAgent = RuleAgent.newRuleAgent(prop);

       

      RuleBase ruleBase = ruleAgent.getRuleBase();

       

      FactType factType = ruleBase.getFactType(

      "org.sample.Number");

      .....

       

      Here is the AS output:

      14:36:27,449 INFO  [STDOUT] INFO  24-11 14:36:27,449 (RepositoryServlet.java:allowUser:113)      john authenticated for rest api
      14:36:27,465 INFO  [STDOUT] INFO  24-11 14:36:27,449 (PackageDeploymentServlet.java:execute:134)     PackageName: org.sample
      14:36:27,465 INFO  [STDOUT] INFO  24-11 14:36:27,465 (PackageDeploymentServlet.java:execute:135)     PackageVersion: TestSnapshot
      14:36:27,465 INFO  [STDOUT] INFO  24-11 14:36:27,465 (PackageDeploymentServlet.java:execute:136)     PackageIsLatest: false
      14:36:27,465 INFO  [STDOUT] INFO  24-11 14:36:27,465 (PackageDeploymentServlet.java:execute:137)     PackageIsSource: false

      If I am not mistaken, authentication seems to be working since john is able to get in. I am not sure where is the disconnect between the property configuration and the rule agent.

      Any idea on the issue and solution?

      I have been working on this for three days. Any assistance will be greatly appreciated.

      Thanks,

      Jason

       

       

       

       

       

       

       

       

       

       

       

       

       

      java.lang.NullPointerException

        at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:384)
      at org.drools.agent.RuleAgent.configure(RuleAgent.java:368)
      at org.drools.agent.RuleAgent.init(RuleAgent.java:268)
      at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:208)
      at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:168)
      at main.java.DroolsGuvnor.main(DroolsGuvnor.java:32)