cancel
Showing results for 
Search instead for 
Did you mean: 

Business Rule Task

sandhya_m
Champ in-the-making
Champ in-the-making
Hi Guys,
Can any one tell why this error is coming when iam trying to run a drl…through a bpnm20.xml

error:
org.activiti.engine.ActivitiException: deployment 20601 doesn't contain any rules

Java code:
              ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
              RepositoryService repositoryService = processEngine.getRepositoryService();
         RuntimeService runtimeService = processEngine.getRuntimeService();
      repositoryService.createDeployment()
      .addClasspathResource("rulesdemo.bpmn20.xml")
      .deploy();
      runtimeService.startProcessInstanceByKey("rulesdemo");


bpnm20.xml:
  <businessRuleTask completionQuantity="1" activiti:rules="demo" id="sid-A917D25A-C3B1-4A83-BB01-FAB530A4CF1E" implementation="other" isForCompensation="false" name="businessRuleTask&#10;" startQuantity="1">

rule:

rule "demo"
when
then
System.out.println("HELLO");
end


Regards,
Sandhya
15 REPLIES 15

trademak
Star Contributor
Star Contributor
Hi,

You have to add the Drools drl or equivalent file as well to the deployment.

Best regards,

sandhya_m
Champ in-the-making
Champ in-the-making
Firstly thanks for ur reply..

i have used

rules.drl in my deployment

rule "demo"
when
then
System.out.println("HELLO");
end

The thing is ,im calling the rules from my bpnm file(activi:rules="demo")but its nt wrkng (error is generating)
So, how can i call it from my bpnm file /java file so that my rule will execute successfully



Regards,
Sandhya

trademak
Star Contributor
Star Contributor
Hi,

You say you have the following Java code:

ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
repositoryService.createDeployment()
  .addClasspathResource("rulesdemo.bpmn20.xml")
  .deploy();
runtimeService.startProcessInstanceByKey("rulesdemo");

Just add an additional

.addClasspathResource("rules.drl")
to the createDeployment statement.

Best regards,

sandhya_m
Champ in-the-making
Champ in-the-making
Hi,

i have changed my code like this,After changing that there is no change in my error  Smiley Sad                

                RepositoryService repositoryService = processEngine.getRepositoryService();
  RuntimeService runtimeService = processEngine.getRuntimeService();
  repositoryService.createDeployment()
  .addClasspathResource("rulesdemo.bpmn20.xml")
  .deploy();
  runtimeService.startProcessInstanceByKey("rulesdemo");
  Deployment deployment = repositoryService.createDeployment()
   .addClasspathResource("rules.drl")
    .deploy();
ERROR
Exception in thread "main" org.activiti.engine.ActivitiException: deployment 22401 doesn't contain any rules

help me

Regards,
Sandhya

gant
Champ in-the-making
Champ in-the-making
Hi,

You have to deploy the drl-file (the way you do) BEFORE you start the process using processService. Just adjust the order of your code-lines…

Regards.

sandhya_m
Champ in-the-making
Champ in-the-making
Hi,

Iam new to this acitviti i didnt get what u said…..
Could u plz tell it in other way…


but it tried like this

RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
repositoryService.createDeployment()
.addClasspathResource("rulesdemo.bpmn20.xml")
.deploy();

Deployment deployment = repositoryService.createDeployment()
.addClasspathResource("rules.drl")
.deploy();

runtimeService.startProcessInstanceByKey("rulesdemo");///just changed this part

even though same error…..

Regards,
Sandhya

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
It should be in ONE deployment, not two
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
repositoryService.createDeployment()
.addClasspathResource("rulesdemo.bpmn20.xml")
.addClasspathResource("rules.drl")
.deploy();

sandhya_m
Champ in-the-making
Champ in-the-making
Hi,
I have done like this…my issue is it is not printing the sop stmt in the rule


rule "demo"
when
then
    System.out.println("INTO DEMO——————–");
end

Regards,
Sandhya

sandhya_m
Champ in-the-making
Champ in-the-making
Reply??