[rules-users] Drools and jBPM integration
Fabian Weisensee
fabian at weisensee.net
Mon Nov 12 12:23:06 EST 2007
Yes, thanks for your help. I'll try your suggestion for #2.
I resolved the deployment problem by myself. It was just a mistake with
the JBoss ESB deploying...
But now I have another problem. The rule file is found, but there seem
to be some problems with the parser.
The FireRulesActionHandler class from the jbpm wiki uses the following code:
RuleBaseImpl ruleBase = new RuleBaseImpl();
ruleBase.addPackage(pkg);
But the RuleBaseImpl class doesn't seem to be part of drools anymore. I
looked at the javadocs to find a replacement. I've found the
RuleBaseLoader class which looked like what I needed. I replaced the two
lines with this:
RuleBaseLoader rbl = RuleBaseLoader.getInstance();
RuleBase ruleBase = rbl.loadFromReader(reader);
ruleBase.addPackage(pkg);
but when I run this I get the following error:
ERROR [GraphElement] action threw exception: Unable to parser Reader
java.lang.RuntimeException: Unable to parser Reader
at org.drools.compiler.DrlParser.getParser(DrlParser.java:209)
at org.drools.compiler.DrlParser.parse(DrlParser.java:60)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:165)
at
org.drools.compiler.RuleBaseLoader.loadFromReader(RuleBaseLoader.java:38)
at
rechnung.kontrolle.FireRulesActionHandler.readRule(FireRulesActionHandler.java:92)
at
rechnung.kontrolle.FireRulesActionHandler.execute(FireRulesActionHandler.java:49)
Of course I thought my rule file would be syntacticaly incorrect, but
even this rule file didn't work:
package rechnung.kontrolle
rule "test rule 1"
when
then
System.out.println("rule fired!");
end
What am I doing wrong? Is RulesBaseLoader the right class?
Are there any other Informations about integrating jBPM and Drools?
--Fabian
Aziz Boxwala schrieb:
> Fabian,
>
> Response to #1: I believe the rule file needs to reside in the root
> directory of the archive/directory of the example application. I have
> not tried that out so not sure.
>
> With Drools 4.0.x, you have the option of having your rules be located
> in the BRMS.
>
> Response to #2: You should be able to do so using one decision-node.
> Associate the rule action handler with either the Before Signal or Node
> Enter event and specify your decision conditions on the transitions out
> of that node..
>
> --Aziz
>
> ----- Original Message ----
> From: Fabian Weisensee <fabian at weisensee.net>
> To: rules-users at lists.jboss.org
> Sent: Monday, November 12, 2007 7:35:02 AM
> Subject: [rules-users] Drools and jBPM integration
>
> Hi there
>
> I have some questions concerning Drools and jBPM integration.
> I know there is this wiki page:
> http://wiki.jboss.org/wiki/Wiki.jsp?page=JbpmAndDrools
> but first it's not really detailed and second does it seem to be outdated.
>
> 1) I changed the FireRulesActionHandler from the wiki to reflect the
> API-changes, that at least it's compileable. In the jBPM process
> definition the rule file is simply passed as parameter like this:
> "/Shipper.drl". To which directory does this relative path apply? So
> where do I have to deploy this rule file? I tried several locations in
> the application server, but even with an absolute path every time
> FireRulesActionHandler tries to read the rule it crashes:
>
> ERROR [GraphElement] action threw exception: null
> java.lang.NullPointerException
> at java.io <http://java.io.Re>.Reader.<init>(Unknown Source)
> at java.io <http://java.io.In>.InputStreamReader.<init>(Unknown Source)
> at
> rechnung.kontrolle.FireRulesActionHandler.readRule(FireRulesActionHandler.java:83)
> at
> rechnung.kontrolle.FireRulesActionHandler.execute(FireRulesActionHandler.java:50)
>
> 2) As I understood the example in the wiki you have to create a node
> which executes the rule and then a decision-node which routes the
> process flow according to the rule results.
> Is it possible to do this with just one node?
> But perhaps I should ask this at the jBPM forums.
>
> Every help would be appreciated. Thanks in advance.
>
> Fabian Weisensee
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
More information about the rules-users
mailing list