You are using the old apis,
take a look at the docs about the 5 version to update your code.
If you are working with maven, it should work on eclipse and netbeans.
I'm a netbeans user and I got all my examples running.
Noe using drools 5.
_______________________________________________On May 6, 2010 12:08 PM, "salaboy [via Drools - Java Rules Engine]" <[hidden email]> wrote:
Are you using Drools 4.x for a particular reason? I suggest you to try with 5.xOn Thu, May 6, 2010 at 2:56 PM, mikexr <[hidden email]> wrote:
I am trying to execute a proof of concept. I have some code that runs a
rule. It works in Eclipse, but for some reason doesnt in Netbeans. I want
to get it working within a POJO Service Engine in Glassfish ESB and have is
execute as part of a BPEL orchestration. It does not throw an exception,
but it steps over that one piece of code
public void xmlImpl(String is) throws JAXBException,
FileNotFoundException, Exception {
try {
// unmarshal xml file
// JAXBElement<EnrollmentRequest> enrollment =
jaxbUnmarshalFromInputStream(is);
EnrollmentRequest enrollment = jaxbUnmarshalFromInputStream(is);
// setup rules engine
RuleRunner rule = new RuleRunner();
String[] rules = {"../rules/834rules.drl"};
// execute rules on xml file
try {
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
PackageBuilder builder = new PackageBuilder();
for (String ruleFile : rules) {
System.out.println("Loading file: " + ruleFile);
builder.addPackageFromDrl(new
InputStreamReader(this.getClass().getResourceAsStream(ruleFile)));
}
Package pkg = builder.getPackage();
ruleBase.addPackage(pkg);
WorkingMemory workingMemory = ruleBase.newStatefulSession();
Object fact = new Object();
fact.equals(enrollment);
System.out.println("Inserting fact: " + fact);
workingMemory.insert(fact);
System.out.println("Firing Rules");
workingMemory.fireAllRules();
} catch (Exception e) {
e.printStackTrace();
}
// marshall changes out to xml file
jaxbMarshalToOutputStream(enrollment, new
FileOutputStream("F:/data/workspaces/enrollmentPOC/data/xmlenrollment.xml"));
} catch (JAXBException je) {
je.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
} catch (Exception ex) {
java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE,
null, ex);
}
return;
}
}
If anyone has any suggestions I would appreciate them. At this point I'm
stuck
Thanks
[hidden email]--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Does-not-execute-builder-addPackageFromDrl-new-InputStreamReader-this-getClass-getResourceAsStream-r-tp781934p781934.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users mailing list
[hidden email]
View message @ http://drools-java-rules-engine.46999.n3.nabble.com/Does-not-execute-builder-addPackageFromDrl-new-InputStreamReader-this-getClass-getResourceAsStream-r-tp781934p781968.html
To unsubscribe from Does not execute => builder.addPackageFromDrl(new InputStreamReader(this.getClass().getResourceAsStream(ruleFile))), click here.
View this message in context: Re: Does not execute => builder.addPackageFromDrl(new InputStreamReader(this.getClass().getResourceAsStream(ruleFile)))
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users