cancel
Showing results for 
Search instead for 
Did you mean: 

Integrating Drools with Activiti 5.14 (NoClassDefFoundError: org/drools/runtime/rule/AgendaFilter)

johnm
Champ in-the-making
Champ in-the-making
Hi All,

I'm really struggling with getting set up to use drools with Activiti 5.14. Any help..Steers.. or suggestions..would be greatly appreciated.
I've picked Drools 5.5.0.Final. First off is this the correct version to use with Activiti 5.14?

In my pom.xml I have:

<activiti-version>5.14</activiti-version>
<drools-version>5.5.0.Final</drools-version>

Drools dependenceies as follows:

<dependency>
   <groupId>org.drools</groupId>
   <artifactId>drools-core</artifactId>
   <version>${drools-version}</version>
</dependency>
<dependency>
   <groupId>org.drools</groupId>
   <artifactId>drools-compiler</artifactId>
   <version>${drools-version}</version>
</dependency>
<dependency>
   <groupId>org.drools</groupId>
   <artifactId>knowledge-api</artifactId>
   <version>${drools-version}</version>
</dependency>

What is this knowledge-api? (I added it to the pom because I could see it has org/drools/runtime/rule/AgendaFilter in it
.. however with it in, or out it does not work)

At runtime, I programmatically deploy a process as follows:

// Deploy the process definition
repositoryService.createDeployment()
   .addClasspathResource("./diagrams/FinancialReportProcess.bpmn20.xml")
   /* only the following process has a rule..*/
   .addClasspathResource("./diagrams/FinancialReportProcessWithNoddyRule.bpmn20.xml")
   .deploy();
          
Exception in thread "Thread-12" java.lang.NoClassDefFoundError: org/drools/runtime/rule/AgendaFilter
        at org.activiti.engine.impl.bpmn.parser.factory.DefaultActivityBehaviorFactory.createBusinessRuleTaskActivityBehavior(DefaultActivityBehaviorFactory.java:236)
        at org.activiti.engine.impl.bpmn.parser.handler.BusinessRuleParseHandler.executeParse(BusinessRuleParseHandler.java:37)
        at org.activiti.engine.impl.bpmn.parser.handler.BusinessRuleParseHandler.executeParse(BusinessRuleParseHandler.java:25)
        at org.activiti.engine.impl.bpmn.parser.handler.AbstractBpmnParseHandler.parse(AbstractBpmnParseHandler.java:79)
        at org.activiti.engine.impl.bpmn.parser.handler.AbstractFlowNodeBpmnParseHandler.parse(AbstractFlowNodeBpmnParseHandler.java:27)

..
..

I used Activiti Eclipse BPMN 2.0 Designer   5.15.0.201407081458 to generate the bpmn20.xml.

I noticed also in one of the ant scripts around Drools (in your Ativiti in Action book ) you copy "mvel2-2.1.0.drools4.jar"
where does this come into it??

Any process's with no Drools Rules are all fine.. I can play around with them, but just cannot get to see any Drools Rules.
Any help? Steers? or suggestions..? 



5 REPLIES 5

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

What is this knowledge-api?
read drools docs.

Exception in thread "Thread-12" java.lang.NoClassDefFoundError: org/drools/runtime/rule/AgendaFilter
Add drools dependencies to the class path.

Regards
Martin

johnm
Champ in-the-making
Champ in-the-making
Hi Martin,
thanks for responding. It was'nt clear from my question above (because the forum stripped out the xml 😞 … my bad for not wrapping in in code element)..

But of course, I do have (to the best of my knowledge) drools dependencies in my pom.xml… as follows:
<code>
    <activiti-version>5.14</activiti-version>
    <drools-version>5.5.0.Final</drools-version>
    <dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${drools-version}</version>
  </dependency>
<dependency>
  <groupId>org.drools</groupId>
  <artifactId>drools-compiler</artifactId>
  <version>${drools-version}</version>
</dependency>
<dependency>
  <groupId>org.drools</groupId>
  <artifactId>knowledge-api</artifactId>
  <version>${drools-version}</version>
</dependency>
<code>

But at runtime I get the exception above. So my question is (or has become..) what is the correct maven dependencies for drools?

;-(… I wont tell you how long I've spent on this.. and really appreciate any input?


Do I need mvel2-2.1.0.drools4.jar..( as is in some of the examples?).
I'm using Activiti 5.14 with Drools 5.5.0.Final. Is this ok?

thanks so much
John

trademak
Star Contributor
Star Contributor
Hi John,

In the Activiti Engine tests we use two dependencies: drools-core and drools-compiler both 5.5.0.Final .
These dependencies will include mvel2 and knowledge-api etc child dependencies.
If you are still running into issues, please create a unit test showing the issue and create a JIRA issue, that makes it easy for us to reproduce the issue and help resolve it.

Best regards,

johnm
Champ in-the-making
Champ in-the-making
**Solved** Yey!…

Ok, so I've been deploying my activiti/drools application *and* the activiti-explorer app to the same intance of jetty. Both apps logging to the same console.. (you know where this is going…!). It was activiti-explorer writing the NoClassDefFoundError to the console.
I added the drools dependencies to the jetty plugin  I'm using as follows:
<code>
<dependency>
    <groupId>org.drools</groupId>
    <artifactId>drools-core</artifactId>
    <version>${drools-version}</version>
</dependency>
<dependency>
    <groupId>org.drools</groupId>
    <artifactId>drools-compiler</artifactId>
    <version>${drools-version}</version>
</dependency>
</code>

And all is fine with the deployment now… I can start actually getting some rules to run.
Thanks for taking the time to respond to my pleas earlier!!

jbarrez
Star Contributor
Star Contributor
No problem. Glad you made it work!