<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>


This isn't my code.&nbsp; It's created when a Drools project is created in
Eclipse.&nbsp; I guess that's why this is so frustrating.&nbsp; It's supposed to
demonstrate a very simple Drools program and I can't get it to work.&nbsp;
It's hard to debug someone else's code when you don't know the language
yet.<br>
<br>
Code is kSession.insert(message);<br>
<br>
Thanks<br>
<br>
sdjoe [via Drools] wrote:<br>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' cite="mid1390925652690-4027888.post@n3.nabble.com"
 type="cite"> Hard to say without seeing your code. Can you post it
here and point out where the NPE is happening on line 23? <br>
  <br>
  <hr color="#cccccc" noshade="noshade" size="1">
  <div
 style="color: rgb(68, 68, 68); font-family: tahoma,geneva,helvetica,arial,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;">
  <div style="font-weight: bold;">If you reply to this email, your
message will be added to the discussion below:</div>
  <a
 href="http://drools.46999.n3.nabble.com/Drools-slf4j-and-Eclipse-Error-on-DroolsTest-Java-tp4027853p4027888.html" target="_top" rel="nofollow" link="external">http://drools.46999.n3.nabble.com/Drools-slf4j-and-Eclipse-Error-on-DroolsTest-Java-tp4027853p4027888.html</a>
  </div>
  <div
 style="color: rgb(102, 102, 102); font-family: tahoma,geneva,helvetica,arial,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; font-size-adjust: none; font-stretch: normal; margin-top: 0.4em; line-height: 1.5em;">
To unsubscribe from Drools, slf4j and Eclipse Error on DroolsTest.Java,
  <a
 href="" target="_top" rel="nofollow" link="external">click
here</a>.<br>
  <a
 href="http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow"
 style="font-family: serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 9px; line-height: normal; font-size-adjust: none; font-stretch: normal;" target="_top" link="external">NAML</a>
  </div>
</blockquote>


<br />package com.sample;
<br/><br/>import org.kie.api.KieServices;
<br/>import org.kie.api.runtime.KieContainer;
<br/>import org.kie.api.runtime.KieSession;
<br/><br/>/**
<br/>&nbsp;* This is a sample class to launch a rule.
<br/>&nbsp;*/
<br/>public class DroolsTest {
<br/><br/>&nbsp; &nbsp; public static final void main(String[] args) {
<br/>&nbsp; &nbsp; &nbsp; &nbsp; try {
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // load up the knowledge base
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KieServices ks = KieServices.Factory.get();
<br/>&nbsp; &nbsp;          &nbsp; &nbsp;KieContainer kContainer = ks.getKieClasspathContainer();
<br/>&nbsp; &nbsp; &nbsp; &nbsp;         KieSession kSession = kContainer.newKieSession(&quot;ksession-rules&quot;);
<br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // go !
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Message message = new Message();
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; message.setMessage(&quot;Hello World&quot;);
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; message.setStatus(Message.HELLO);
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; kSession.insert(message);
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; kSession.fireAllRules();
<br/>&nbsp; &nbsp; &nbsp; &nbsp; } catch (Throwable t) {
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t.printStackTrace();
<br/>&nbsp; &nbsp; &nbsp; &nbsp; }
<br/>&nbsp; &nbsp; }
<br/><br/>&nbsp; &nbsp; public static class Message {
<br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; public static final int HELLO = 0;
<br/>&nbsp; &nbsp; &nbsp; &nbsp; public static final int GOODBYE = 1;
<br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; private String message;
<br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; private int status;
<br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; public String getMessage() {
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return this.message;
<br/>&nbsp; &nbsp; &nbsp; &nbsp; }
<br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; public void setMessage(String message) {
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.message = message;
<br/>&nbsp; &nbsp; &nbsp; &nbsp; }
<br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; public int getStatus() {
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return this.status;
<br/>&nbsp; &nbsp; &nbsp; &nbsp; }
<br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; public void setStatus(int status) {
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.status = status;
<br/>&nbsp; &nbsp; &nbsp; &nbsp; }
<br/><br/>&nbsp; &nbsp; }
<br/><br/>}
<br/>

        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://drools.46999.n3.nabble.com/Drools-slf4j-and-Eclipse-Error-on-DroolsTest-Java-tp4027853p4027893.html">Re: Drools, slf4j and Eclipse Error on DroolsTest.Java</a><br/>
Sent from the <a href="http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html">Drools: User forum mailing list archive</a> at Nabble.com.<br/>