Niyas,

Seems that a.getempDAOTarget() is returning null. Can you check if your bean has this propertie correctly set?

  []s
  Edson

Niyas wrote:

I am trying to use Drools with Spring-Hibernate. I don't know whether
it's a proper way of using Drools with Spring and Hibernate.
I am having the MVC application in Spring. This MVC application is
having the form for adding the employee id and employee name. I have a
bean for Employee. And EmployeeContoller using SimpleFormController in
Spring. And I am having the DAO Interface with two methods
addEmp(Employee e) and displayEmp(empid) and the implementation for
this interface in Hibernate.

What I am trying to do is, I am checking a conditon in .drl file, if
it satisfies the condition in the then part I need to save the
employee bean into database.

My DRL:
package com.example;

import com.example.EmployeeBean;

rule "My First Rule" when
        a:EmployeeBean(empName == "Andrew")
    then
System.out.println("Hi Andrew -- My First Rule is Fired Successfully!!");
        a.getempDAOTarget().addEmp(a);
end


But I am getting the following error:

It's Endowment Policy -- My First Rule is Fired Successfully!!
java.lang.NullPointerException
at com.example.Rule_My_First_Rule_0.consequence(Rule_My_First_Rule_0.java:9) at com.example.Rule_My_First_Rule_0ConsequenceInvoker.evaluate(Rule_My_First_Rule_0ConsequenceInvoker.java:22)
    at org.drools.common.DefaultAgenda.fireActivation(Unknown Source)
    at org.drools.common.DefaultAgenda.fireNextItem(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source) at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
    at com.example.PolicyController.onSubmit(PolicyController.java:41)
at org.springframework.web.servlet.mvc.SimpleFormController.onSubmit(SimpleFormController.java:356) at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:258) at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:249) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:723) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:663) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:394) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:358)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email




--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @ www.jboss.com



---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to