cancel
Showing results for 
Search instead for 
Did you mean: 

Deploying a drools rule file using the API

surreal1991
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to figure out Activiti and I'm stuck on trying to get a Business Rule Task working.

My .drl file contains:

//created on: 2014-08-29
package rules

rule "rule1"
    when
        eval(true)
    then
        System.out.println("+++   rule1");
end


And I deploy it in Java as such:

repositoryService.createDeployment().addInputStream(rule, new FileInputStream(pathToRule)).addInputStream(processName, new FileInputStream(pathToProcess)).deploy();


In the eclipse designer my business rule task properties are:
<businessRuleTask id="businessruletask1" name="Business rule task" activiti:rules="rule1"></businessRuleTask>


The error I'm getting is: deployment 1 doesn't contain any rules.

The deployment seems to go ok:
2014-08-29 17:19:47 org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource business1.drl
2014-08-29 17:19:47 org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource proces_3.bpmn20.xml

Where could the problem be? I have read previously that I have to deploy a .BAR file with the .drl file inside, but that seems to be the case for Activiti Explorer. The rule is pretty straightforward, and the deployment seems to be processed successfully. Is there a problem with my Business Task properties? I have read the documentation but tbh it's not very clear on many things, it does say that "we need to define the input and result variables" but if I'm correct those are the variables used in the rule and the resulting process variable so it should not apply to my simple rule.

Thanks in advance for the help.
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
Indeed - should work

The logging seems to indicate it is correct.

Did you try adding something in the activiti:ruleVariablesInput="${order}" activiti:resultVariable="rulesOutput" parameters, just to check if those aren't mandatory?

surreal1991
Champ in-the-making
Champ in-the-making
Unfortunately adding input and output variables does not help. The root of the problem has to be the deployment since it says that the deployment does not contain any rules but I can't check what is exactly in the deployment in the database, can I? Another thing I'm not sure of, so it could be a problem, is the package of the .drl file. I wasn't sure how to name the package in the drools file creation so I just gave it a random name, maybe that could be the problem?

Also a little bit off-topic: How can I add .java class listeners to the .bar file. I'd like to try and run the process on Activiti Explorer, maybe that will give me more insight into the problem.