cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to connect Activiti with drools

deepakchoudhary
Champ in-the-making
Champ in-the-making
I want to integrate drools rules with activiti and on deploying my .BAR file (which contains .drl file also) I get an error message Deployment xxxx does not contain rules.
I am new to java, activiti and drools.

I have followed the steps on the thread http://forums.activiti.org/content/businessruletask-deploy-error.
therefor I have added these jars to /path/to/webapps/activiti-explorer/WEB-INF/libs/ as well as to the maven dependencies in my project:
drools-api-5.1.1.jar
droools-core-5.1.1.jar
drools-compiler-5.1.1.jar
mvel2-2.1.0.drools.jar


Also I have edited the applicationContext.xml file  in /path/to/webapps/activiti-explorer/

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
   xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jee="http://www.springframework.org/schema/jee"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
       http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd">
      
  <import resource="activiti-standalone-context.xml" />
  <import resource="activiti-ui-context.xml" />
   <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
      <property name="databaseSchemaUpdate" value="true" />
      <property name="customPostDeployers">
         <list>
            <bean class="org.activiti.engine.impl.rules.RulesDeployer" />
         </list>
      </property>
   </bean>
</beans>

I have created a simple project using eclipse with a bpmn file and a business rule.
After deploying when I start the process and the user fills the form an error occurs- Deployment xxxx does not contain rules.
The user at the thread I have mentioned above suggested to read chapter 12 of the book- activiti in action, but I could not understand much of it. For eg in which directory should I include the java code, mentioned in the book, with my project.
Any help would be highly appreciated.
20 REPLIES 20

jbarrez
Star Contributor
Star Contributor
It's very hard to see with this info what went wrong. You need to have the .drl in the .bar. You need to deploy the bar to the engine. You need to reference the correct rule in your process … did you do all that?

By the way, the code of the book is freely available at http://www.bpmnwithactiviti.org/book_sourcecode.html
You can always check there

jBarrez Thanks for the link but I couldn't make much out of it.(I actually already had seen the link and had the source code for the book activiti in action.)
This code in the book as well as other threads contain info only for old versions of activiti.
I want to do the integration on activiti 5.12.1 with drools.
Here is the link to my eclipse project
https://github.com/deepakchoudhary/activiti-drools/tree/master/eclipse_project/Calculator
It contains POJO as the input and output object.
As mentioned I have added these four :drools-api, drools-compiler, drools-core and mvel2 jar
to /path/to/tomcat/webapps/activiti-explorer/WEB-INF/lib &
/path/to/tomcat/webapps/activiti-rest/WEB-INF/lib
& I have done no other configurations other than this on server side.
It would be great if you could tell the steps of point towards the steps to do the integration.
(My current problem is still after deploying I still get the error: Deployment xxxx does not contain any rules)

trademak
Star Contributor
Star Contributor
And does it deploy the process definition successfully?
I tried to extract you BAR file, but I get error messages in every extraction tool I have installed.
So I can't validate if the BAR file is correct.

Best regards,

deepakchoudhary
Champ in-the-making
Champ in-the-making
Trademak thanks for your fast reply.
If you click on this the proper bar file will be downloaded if that's what you are trying.
https://github.com/deepakchoudhary/activiti-drools/blob/master/eclipse_project/Calculator/deployment...
I tried downloading this and then using actviti-explorer(5.12.1) I deployed the file and it showed three files.
Calculator_flow.bpmn20.xml
Calculator_flow.myProcess.png
rules.drl
And the name of my Process Definition is myProcess and yes it deploys fine and I only get the error(Deployment xxxx does not contain any rules) when the user tries to submit the user task form which leads to the next step, a business task. I have referenced the rule name as rule1 in business task.
(You'll also need to add the four jar files to activiti-explorer and activiti-rest [otherwise it shows org/runtime/drools/rule/agendaFilter] but I believe you already know that)

trademak
Star Contributor
Star Contributor
You need to make sure that the drl is correct. You have an additional "end" statement in the file, so it doesn't parse it correctly.
The Tomcat log file should show that as well.

Best regards,

Hi Trademak thanks again for the fast reply..
I have corrected it and now you can download the bar file on the same link(The error is still the same)

frederikherema1
Star Contributor
Star Contributor
Do you see any additional logging when the user tries to start the task for the same time? This could shed light on what's wrong with your .drl-file. Since the error-message states "deployment XX doesn't contain rules" is shown, the rules-deployer kicks in…

Hi Frederik,
Attached is my catalina log, the last thing I tried to say was to start the process and submit the form where I got the same error which I keep on saying.
Just to clarify I am deploying directly from activiti explorer and I I get a red box showing the error when I try to submit. No other error can be seen on the screen as such.

related to this matter I have 3 questions:-
1) I have not used any code relating to some knowledge base. Do I have to write anything related to it?
2) Do I need to make any changes in my activiti.cfg.xml which is by default in the eclipse activiti project.
<code>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
  <property name="databaseSchemaUpdate" value="true"/>
 
   <property name="customPostDeployers">
         <list>
           <bean class="org.activiti.engine.impl.rules.RulesDeployer" />
         </list>
      </property>
</bean>

</beans>

</code>
3) Do i need to make change the applicationContext.xml in /path/to/tomcat/webapps/activiti-explorer/WEB-INF/
<code>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
       http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd">
      
  <import resource="activiti-standalone-context.xml" />
  <import resource="activiti-ui-context.xml" />
 
 
</beans>

</code>

trademak
Star Contributor
Star Contributor
Hi,

I just gave your new BAR and JAR a try and now I get this error message:

04:43:04,698 [http-bio-8080-exec-4] INFO  org.activiti.engine.impl.rules.RulesDeployer  - Processing resource rules.drl
Rule Compilation error : [Rule name='rule1']
org/activiti/demo/rules/Rule_rule1_5c9dfae5adbd472590f0c2368a81dabc.java (9:497) : The method setResult(int) in the type RuleOutput is not applicable for the arguments (String)

Are you using the Activiti Explorer to deploy your process? You should get an error message there when the rule parsing fails.

Best regards,