<div dir="ltr">Without line numbers we can but guess.<br><br>I&#39;d gamble that the NPE relates to not being able to find /Guvnor.properties on your class path.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On 30 August 2013 14:05, Smurfs <span dir="ltr">&lt;<a href="mailto:smurfs.doll@gmail.com" target="_blank">smurfs.doll@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi<br>
<br>
I am new to Drools. I am using a maven project to connect to guvnor and<br>
execute the rules.<br>
<br>
<br>
pom.xml<br>
-----------<br>
 &lt;dependency&gt;<br>
      &lt;groupId&gt;org.drools&lt;/groupId&gt;<br>
      &lt;artifactId&gt;drools-compiler&lt;/artifactId&gt;<br>
      &lt;version&gt;5.5.0.Final&lt;/version&gt;<br>
    &lt;/dependency&gt;<br>
<br>
Code<br>
-----<br>
 public static void main(String[] args) throws InstantiationException,<br>
                        IllegalAccessException {<br>
<br>
       KnowledgeAgent ruleAgent =<br>
KnowledgeAgentFactory.newKnowledgeAgent(&quot;/Guvnor.properties&quot;);<br>
<br>
<br>
System.out.println(ruleAgent.getKnowledgeBase().getFactType(&quot;org.sample&quot;,&quot;NumberTest&quot;));<br>
<br>
                KnowledgeBase ruleBase = ruleAgent.getKnowledgeBase();<br>
<br>
<br>
System.out.println(ruleBase.getFactType(&quot;org.sample&quot;,&quot;NumberTest&quot;));<br>
<br>
                FactType factType = ruleBase.getFactType(&quot;org.sample&quot;,<br>
&quot;NumberTest&quot;);<br>
<br>
                Object obj = factType.newInstance();<br>
<br>
                factType.set(obj, &quot;numberone&quot;, 2);<br>
<br>
                factType.set(obj, &quot;numbertwo&quot;, 1);<br>
<br>
                StatefulKnowledgeSession workingMemory =<br>
ruleBase.newStatefulKnowledgeSession();<br>
<br>
                workingMemory.insert(obj);<br>
<br>
                workingMemory.fireAllRules();<br>
<br>
                System.out.println(factType.get(obj, &quot;message&quot;));<br>
<br>
        }<br>
<br>
I am getting the null pointer exception as below:<br>
null<br>
Exception in thread &quot;main&quot; java.lang.NullPointerException<br>
        at com.test.drools.guvnor.App.main(App.java:44)<br>
<br>
<br>
I know, that many people has raised this issue, can anyone know why it is<br>
causing the issue?<br>
Thanks<br>
Smurfs<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Could-not-execute-Rules-getting-NPE-tp4025731.html" target="_blank">http://drools.46999.n3.nabble.com/Could-not-execute-Rules-getting-NPE-tp4025731.html</a><br>

Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br></div>