Drools 5/ Java 8 compatibility

3,110 views
Skip to first unread message

Karun Nadarajah

unread,
Feb 19, 2016, 6:24:08 AM2/19/16
to Drools Setup
I had difficulty finding info about how to make Drools 5 work with Java 8, so I am posting this info here in case it helps anyone.  You do not need to upgrade to Drools 6 to work with Java 8.  If you ensure the eclipse compiler jar you have imported is version 4.3.1 or higher (ecj-4.3.1.jar), then Drools 5 will work fine with Java 8.

Pete Yan

unread,
May 29, 2016, 3:27:03 AM5/29/16
to Drools Setup
Thanks very much for your share. It has resolve my problems.
I'm use drools5.6 and jdk8, found the same questions, the .drl compiler can not use Map or HashMap. Error like this:
java.lang.NoClassDefFoundError: com/xx/rule/Rule_rule_57497bdaf1566880f896efaa_865eb46b6ad7410eab166a448f72df53

 Add maven conf like this and resolved:
<dependency>
    your drools 5 jars...
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.5.1</version>
</dependency>

在 2016年2月19日星期五 UTC+8下午7:24:08,Karun Nadarajah写道:

Edward Cai

unread,
Jun 27, 2016, 12:20:11 PM6/27/16
to Drools Setup
Hello Pete,

Could you please share the source code how you make drools 5 work with JDK 1.8?

Very appreciated!
Edward

Pete Yan

unread,
Jun 28, 2016, 11:59:08 PM6/28/16
to Drools Setup
As I said, you need not to change your java code. 
Just add the maven pom config. The reason as Karun said because of  drools compiler. So you need just one thing that is change the drools5 compiler.
在 2016年6月28日星期二 UTC+8上午12:20:11,Edward Cai写道:

Shailesh Singh

unread,
Oct 24, 2017, 11:29:07 PM10/24/17
to Drools Setup
Hi Pete,
I did the same but things are not moving there is a ecj-.*.jar in tomcat too do i need to change to same version too.I will post my pom file as soon as i reach the ofice.

Sadhana

unread,
Jan 17, 2018, 7:45:45 AM1/17/18
to Drools Setup
Hi Karun,

I did upgrade to eclipse compiler to 4.4 and see the corresponding ecj-4.4.jar generated in my maven dependencies.
However, I am still getting the wrong class format exception:

Caused by: org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException.

I tried using different versions of drools including 6.4.0.Final, 5.0.1 as well - but the issue persists. 

I get this error when I try using the Stateless kie session but not with the stateful kie session.

Any thoughts?

Best Regards,
Sadhana
Reply all
Reply to author
Forward
0 new messages