Hi All !
I have an existing web application "Bonus Calculation Management System"
which has been developed in servlet and Hibernate which is interacting with
DB. I have developed a product in Drools using Struts. Now the task is I
have to integrate this drools product in the Existing Servlet application. I
have integrating it converting Struts to Servlet. But it is giving this
exception about my Rule File :
*
com.drools.action.PolicyAction
hurrrrrrrrrrrrrr
java.io.FileNotFoundException: Cannot find rule file:Sample.drl
at com.drools.facts.RuleRunner.loadRuleFile(RuleRunner.java:89)
at com.drools.facts.RuleRunner.loadRules(RuleRunner.java:67)
at com.drools.facts.RuleRunner.getStatefulSession(RuleRunner.java:227)
at com.drools.facts.RuleMain.main(RuleMain.java:46)*
*In my Servlet class I have written like this :* public int
calculate(HttpServletRequest req, String schId,String schStepID, Date
clcFrDate, Date clcToDate,String runNo)
{
System.out.println("hurrrrrrrrrrrrrr");
InputFormBean inputFormBean=new InputFormBean();
inputFormBean.setFromDate(clcFrDate.toString());
inputFormBean.setToDate(clcToDate.toString());
String fromDateArray[]=inputFormBean.getFromDate().trim().split("/");
String toDateArray[]=inputFormBean.getToDate().trim().split("/");
inputFormBean.setFromDateArray(fromDateArray);
inputFormBean.setToDateArray(toDateArray);
RuleMain ruleMain=new RuleMain();
try {
ruleMain.main(inputFormBean);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return 0;
}
*In the RuleMain.java* : public class RuleMain extends HttpServlet {
private final String[] RULES_FILES8 = new String[] {"Sample.drl"}; // *I
also tried : com.drools.rules/Sample.drl but dint work*
static HashMap<Integer, Double>agntAPEMap=new HashMap<Integer, Double>();
public void main(InputFormBean inputFormBean) throws Exception {
HashMap<String, Object> globals = new HashMap<String, Object>();
//globals.put("index", new Index(0));
StatefulSession statefulSession=new
RuleRunner().getStatefulSession(RULES_FILES8,null,null, globals, null);
......
........
Thanks !!!
--
View this message in context:
http://drools.46999.n3.nabble.com/How-to-integrate-Drools-application-wit...
Sent from the Drools: User forum mailing list archive at
Nabble.com.