<p>Noe using drools 5.</p>
<p><blockquote type="cite">On May 6, 2010 12:08 PM, "salaboy [via Drools - Java Rules Engine]" <<a href="/user/SendEmail.jtp?type=node&node=782001&i=0" target="_top" rel="nofollow">[hidden email]</a>> wrote:<br>
<br>
Are you using Drools 4.x for a particular reason? I suggest you to try with 5.x<br><br><div class="gmail_quote">On Thu, May 6, 2010 at 2:56 PM, mikexr <span dir="ltr"><<a href="http://user/SendEmail.jtp?type=node&node=781968&i=0" rel="nofollow" target="_blank" link="external">[hidden email]</a>></span> wrote:<br>
<br>
I am trying to execute a proof of concept. I have some code that runs a<br>
rule. It works in Eclipse, but for some reason doesnt in Netbeans. I want<br>
to get it working within a POJO Service Engine in Glassfish ESB and have is<br>
execute as part of a BPEL orchestration. It does not throw an exception,<br>
but it steps over that one piece of code<br>
<br>
public void xmlImpl(String is) throws JAXBException,<br>
FileNotFoundException, Exception {<br>
try {<br>
// unmarshal xml file<br>
<br>
// JAXBElement<EnrollmentRequest> enrollment =<br>
jaxbUnmarshalFromInputStream(is);<br>
EnrollmentRequest enrollment = jaxbUnmarshalFromInputStream(is);<br>
<br>
// setup rules engine<br>
RuleRunner rule = new RuleRunner();<br>
<br>
String[] rules = {"../rules/834rules.drl"};<br>
// execute rules on xml file<br>
<br>
try {<br>
<br>
<br>
RuleBase ruleBase = RuleBaseFactory.newRuleBase();<br>
PackageBuilder builder = new PackageBuilder();<br>
<br>
<br>
for (String ruleFile : rules) {<br>
System.out.println("Loading file: " + ruleFile);<br>
builder.addPackageFromDrl(new<br>
InputStreamReader(this.getClass().getResourceAsStream(ruleFile)));<br>
}<br>
<br>
Package pkg = builder.getPackage();<br>
ruleBase.addPackage(pkg);<br>
<br>
WorkingMemory workingMemory = ruleBase.newStatefulSession();<br>
Object fact = new Object();<br>
fact.equals(enrollment);<br>
System.out.println("Inserting fact: " + fact);<br>
workingMemory.insert(fact);<br>
<br>
System.out.println("Firing Rules");<br>
workingMemory.fireAllRules();<br>
<br>
} catch (Exception e) {<br>
e.printStackTrace();<br>
}<br>
<br>
// marshall changes out to xml file<br>
<br>
jaxbMarshalToOutputStream(enrollment, new<br>
FileOutputStream("F:/data/workspaces/enrollmentPOC/data/xmlenrollment.xml"));<br>
<br>
} catch (JAXBException je) {<br>
je.printStackTrace();<br>
} catch (IOException ioe) {<br>
ioe.printStackTrace();<br>
} finally {<br>
try {<br>
} catch (Exception ex) {<br>
<br>
java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE,<br>
null, ex);<br>
}<br>
return;<br>
}<br>
<br>
}<br>
<br>
<br>
If anyone has any suggestions I would appreciate them. At this point I'm<br>
stuck<br>
<br>
Thanks<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Does-not-execute-builder-addPackageFromDrl-new-InputStreamReader-this-getClass-getResourceAsStream-r-tp781934p781934.html" rel="nofollow" link="external" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Does-not-execute-builder-addPackageFromDrl-new-InputStreamReader-this-getClass-getResourceAsStream-r-tp781934p781934.html</a><br>
Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="http://user/SendEmail.jtp?type=node&node=781968&i=1" rel="nofollow" target="_blank" link="external">[hidden email]</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" rel="nofollow" link="external" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br> - <a href="http://salaboy.wordpress.com" rel="nofollow" link="external" target="_blank">http://salaboy.wordpress.com</a><br> - <a href="http://www.jbug.com.ar" rel="nofollow" link="external" target="_blank">http://www.jbug.com.ar</a><br>
- Salatino "Salaboy" Mauricio -<br>
<br>_______________________________________________
<br>rules-users mailing list
<br><a href="http://user/SendEmail.jtp?type=node&node=781968&i=2" rel="nofollow" target="_blank" link="external">[hidden email]</a>
<br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" rel="nofollow" link="external" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br><br>
<hr noshade size="1" color="#cccccc">
<div style="color:#666666;font:11px tahoma,geneva,helvetica,arial,sans-serif">
View message @ <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Does-not-execute-builder-addPackageFromDrl-new-InputStreamReader-this-getClass-getResourceAsStream-r-tp781934p781968.html" target="_blank" rel="nofollow" link="external">http://drools-java-rules-engine.46999.n3.nabble.com/Does-not-execute-builder-addPackageFromDrl-new-InputStreamReader-this-getClass-getResourceAsStream-r-tp781934p781968.html</a>
<br>To unsubscribe from Does not execute => builder.addPackageFromDrl(new InputStreamReader(this.getClass().getResourceAsStream(ruleFile))), <a target="_blank" rel="nofollow" link="external">click here</a>.
</div>
<br>
</blockquote></p>
<br><hr align="left" width="300">
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Does-not-execute-builder-addPackageFromDrl-new-InputStreamReader-this-getClass-getResourceAsStream-r-tp781934p782001.html">Re: Does not execute => builder.addPackageFromDrl(new InputStreamReader(this.getClass().getResourceAsStream(ruleFile)))</a><br>
Sent from the <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Drools-User-f47000.html">Drools - User mailing list archive</a> at Nabble.com.<br>