[rules-users] Drools, slf4j and Eclipse Error on DroolsTest.Java

Inastrol terry at inastrol.com
Tue Jan 28 20:01:08 EST 2014


Figured out the problem.  Didn't have Maven installed as a plug-in 
correctly.  The book I'm using to learn Drools, didn't include that step.


Terry Moriarty wrote:

> This isn't my code.  It's created when a Drools project is created in 
> Eclipse.  I guess that's why this is so frustrating.  It's supposed to 
> demonstrate a very simple Drools program and I can't get it to work.  
> It's hard to debug someone else's code when you don't know the 
> language yet.
>
> Code is kSession.insert(message);
>
> Thanks
>
> sdjoe [via Drools] wrote:
>
>> Hard to say without seeing your code. Can you post it here and point 
>> out where the NPE is happening on line 23?
>>
>> ------------------------------------------------------------------------
>> If you reply to this email, your message will be added to the 
>> discussion below:
>> http://drools.46999.n3.nabble.com/Drools-slf4j-and-Eclipse-Error-on-DroolsTest-Java-tp4027853p4027888.html 
>>
>> To unsubscribe from Drools, slf4j and Eclipse Error on 
>> DroolsTest.Java, click here 
>> <http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4027853&code=dGVycnlAaW5hc3Ryb2wuY29tfDQwMjc4NTN8LTIzMTM3NTI5Nw==>.
>> NAML 
>> <http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
>>
>
>------------------------------------------------------------------------
>
>package com.sample;
>
>import org.kie.api.KieServices;
>import org.kie.api.runtime.KieContainer;
>import org.kie.api.runtime.KieSession;
>
>/**
> * This is a sample class to launch a rule.
> */
>public class DroolsTest {
>
>    public static final void main(String[] args) {
>        try {
>            // load up the knowledge base
>	        KieServices ks = KieServices.Factory.get();
>    	    KieContainer kContainer = ks.getKieClasspathContainer();
>        	KieSession kSession = kContainer.newKieSession("ksession-rules");
>
>            // go !
>            Message message = new Message();
>            message.setMessage("Hello World");
>            message.setStatus(Message.HELLO);
>            kSession.insert(message);
>            kSession.fireAllRules();
>        } catch (Throwable t) {
>            t.printStackTrace();
>        }
>    }
>
>    public static class Message {
>
>        public static final int HELLO = 0;
>        public static final int GOODBYE = 1;
>
>        private String message;
>
>        private int status;
>
>        public String getMessage() {
>            return this.message;
>        }
>
>        public void setMessage(String message) {
>            this.message = message;
>        }
>
>        public int getStatus() {
>            return this.status;
>        }
>
>        public void setStatus(int status) {
>            this.status = status;
>        }
>
>    }
>
>}
>  
>




--
View this message in context: http://drools.46999.n3.nabble.com/Drools-slf4j-and-Eclipse-Error-on-DroolsTest-Java-tp4027853p4027904.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140128/a1567858/attachment.html 


More information about the rules-users mailing list