You are using the old apis,<br>take a look at the docs about the 5 version to update your code.<br>If you are working with maven, it should work on eclipse and netbeans.<br>I'm a netbeans user and I got all my examples running.<br>
<br><br><div class="gmail_quote">2010/5/6 mikexr <span dir="ltr"><<a href="mailto:mike@bigfatnuthin.com">mike@bigfatnuthin.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<p>Noe using drools 5.</p>
<p></p><blockquote type="cite"><div class="im">On May 6, 2010 12:08 PM, "salaboy [via Drools - Java Rules Engine]" <<a href="http://user/SendEmail.jtp?type=node&node=782001&i=0" rel="nofollow" target="_blank">[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><div class="gmail_quote"><div><div></div><div class="h5">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" link="external" target="_blank">[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>
</div></div><font color="#888888"><div><div></div><div class="h5">--<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>
</div></div><a href="http://user/SendEmail.jtp?type=node&node=781968&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a><div class="im"><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>
</div></font></div></blockquote><div class="im"><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></div>_______________________________________________
<br>rules-users mailing list
<br><a href="http://user/SendEmail.jtp?type=node&node=781968&i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><div class="im"><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>
</div><hr color="#cccccc" noshade size="1">
<div style="color: rgb(102, 102, 102); 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" 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-tp781934p781968.html</a>
<br>To unsubscribe from Does not execute => builder.addPackageFromDrl(new InputStreamReader(this.getClass().getResourceAsStream(ruleFile))), <a rel="nofollow" link="external">click here</a>.
</div>
<br>
<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" target="_blank">Re: Does not execute => builder.addPackageFromDrl(new InputStreamReader(this.getClass().getResourceAsStream(ruleFile)))</a><div>
<div></div><div class="h5"><br>
Sent from the <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Drools-User-f47000.html" target="_blank">Drools - User mailing list archive</a> at Nabble.com.<br>
</div></div><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>
<br></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>