<HTML dir=ltr><HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2900.3199" name=GENERATOR></HEAD>
<BODY>
<DIV id=idOWAReplyText98722 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>
<DIV id=idOWAReplyText8212 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>Hello all</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>I am using Drools4.0.3</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>I have a J2EE application that I am running on Tomcat.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>I am using a singleton class in which I am doing the following steps in the constructor :</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><STRONG>PackageBuilderConfiguration pkgBuilderCfg = new PackageBuilderConfiguration();<BR>JavaDialectConfiguration javaConf = (JavaDialectConfiguration) pkgBuilderCfg.getDialectConfiguration( "java" );<BR>javaConf.setCompiler( JavaDialectConfiguration.JANINO );<BR>builder = new PackageBuilder(pkgBuilderCfg);<BR>ruleBase = RuleBaseFactory.newRuleBase();</STRONG></DIV>
<DIV dir=ltr><STRONG></STRONG> </DIV>
<DIV dir=ltr>Also I am using a method in the same class to validate the inputs which is as follows:</DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr><STRONG>private void validateXML() throws Exception<BR> {<BR> String drlStr = null;<BR> InputStreamReader drl = null;<BR> File ruleFile = new File(this.fileName);<BR> long curLMTime = ruleFile.lastModified();<BR> if(!(curLMTime == lmdTimeForXML))<BR> {<BR> lmdTimeForXML = curLMTime;<BR> if(strReader != null) {<BR> strReader.close();<BR> strReader = null;<BR> }<BR> if(pkg != null){<BR> String packageName = (ruleBase.getPackage("jbossrules")).getName();<BR> if(packageName != null && packageName.equals("jbossrules")){<BR> Rule[] rules = (ruleBase.getPackage("jbossrules")).getRules();<BR> if(rules != null){<BR> for (int i=0; i<rules.length; i++){<BR> String ruleName = rules[i].getName();<BR> try {<BR> ruleBase.removeRule(packageName,ruleName);<BR> }catch(NullPointerException ne){<BR> }<BR> }<BR> }<BR> }<BR> }<BR> try {<BR> drl =new InputStreamReader(new FileInputStream(this.fileName));<BR> drlStr = this.getInputStreamAsString(drl);<BR> strReader = new StringReader(drlStr);<BR> builder.addPackageFromXml(strReader);<BR> pkg = builder.getPackage();<BR> ruleBase.addPackage(pkg);<BR> } catch (IOException e) {<BR> e.printStackTrace();<BR> log.error("*********Can not create inputstrea************", e);<BR> lmdTimeForXML = 0;<BR> throw e;<BR> //removeRules();<BR> }catch (Exception e) {<BR> e.printStackTrace();<BR> log.error("*********CAN NOT CREATE THE RULE BASE INSTANCE************", e);<BR> lmdTimeForXML = 0;<BR> throw e;<BR> //removeRules();<BR> }finally {<BR> try {<BR> if(drl != null) {<BR> drl.close();<BR> }<BR> } catch (IOException e) {<BR> e.printStackTrace();<BR> log.error("*********Can not create inputstrea************", e);<BR> }<BR> }<BR> }<BR> StatefulSession session = ruleBase.newStatefulSession();<BR> session.insert(this.beanObj);<BR> session.setGlobal("response",this.response);<BR> if(this.assertObjArr != null && this.assertObjArr.length > 0)<BR> {<BR> for(int i=0; i<this.assertObjArr.length; i++)<BR> session.insert(this.assertObjArr[i]);<BR> }<BR> <BR> Agenda agenda=session.getAgenda();<BR> AgendaGroup agendagroup=agenda.getAgendaGroup(this.getMethodName());<BR> session.setFocus(agendagroup);<BR> session.fireAllRules();<BR> ResponseBean res = (ResponseBean)session.getGlobal("response");<BR> this.setResponse(res);<BR> session.clearAgenda();<BR> session.setGlobal("response",null);<BR> session.dispose();<BR> session = null; <BR> }</STRONG></DIV>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2><STRONG></STRONG></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>Now when I am deploying any wrong rule,it gets stored in the memory.If again I am deploying the rules then the previous wrong rules are not deleting.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>Please suggest me how can I overcome this problem?</FONT></DIV>
<DIV dir=ltr><STRONG><FONT face=Arial size=2></FONT></STRONG> </DIV>
<DIV dir=ltr><STRONG><FONT face=Arial size=2></FONT></STRONG> </DIV></DIV>
<DIV id=idSignature527 dir=ltr>
<DIV><FONT face=Arial size=2><EM><STRONG>With Regards</STRONG></EM></FONT></DIV>
<DIV><FONT face=Arial size=2><EM><STRONG>Prateek</STRONG></EM></FONT></DIV></DIV></FONT></DIV></DIV></BODY></HTML>
<table><tr><td bgcolor=#ffffff><font color=#000000><br>
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. <br>
<br>
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.<br>
<br>
www.wipro.com<br>
</font></td></tr></table>