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="mailto:mike@bigfatnuthin.com">mike@bigfatnuthin.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><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" 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="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" 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">http://salaboy.wordpress.com</a><br> - <a href="http://www.jbug.com.ar">http://www.jbug.com.ar</a><br> - Salatino "Salaboy" Mauricio -<br>