Bug 1078146 - Drools and jBPM 6.0 should work on Java 8
Summary: Drools and jBPM 6.0 should work on Java 8
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
Target Milestone: ER5
: 6.1.0
Assignee: Kris Verlaenen
QA Contact: Tibor Zimanyi
Depends On:
TreeView+ depends on / blocked
Reported: 2014-03-19 09:14 UTC by Geoffrey De Smet
Modified: 2015-08-10 06:48 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1091383 (view as bug list)
Last Closed:
Type: Feature Request

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Bugzilla 1174202 None None None Never
Red Hat One Jira Issue Tracker DROOLS-329 Major Resolved ClassFormatException when compile template with latest JDK8 (b114) 2018-11-28 08:02:46 UTC

Internal Links: 1174202

Description Geoffrey De Smet 2014-03-19 09:14:41 UTC
We're seeing reports that Drools 6 does not work on Java 8:

Stacktraces look like this:
Caused by: java.lang.RuntimeException: wrong class format
    at org.drools.compiler.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:279)
    at org.drools.compiler.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:219)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113)

Download Java 8 here:

  Drools should work on JDK 6, 7 and 8 out of the box (without setting any special properties)

Solution proposals:

A) Upgrade ECJ from 3.7.2 to 4.3.1. This might fix it.
B) Change the default compiler from ECJ (=eclipse) to native. This might be slower.

Note: A) and B) are not mutually exclusive.

Comment 2 Mario Fusco 2014-03-19 10:44:45 UTC
I upgraded the Eclipse Java Compiler to version 4.3.1 with the following commits:


Doing so the list of the failing tests in drools-compiler while running Java8 got reduced to the following 5:	

    Failed tests:
      KnowledgeBuilderTest.testDifferentPackages:157 Rule Compilation error : [Rule name='R1']
            org/drools/compiler/test/rule/Rule_R12147099725.java (7:443) : list cannot be resolved
    Tests in error:
      TruthMaintenanceTest.testLogicalInsertionsWithExists:768 » IllegalArgument byt...
      TruthMaintenanceTest.testLogicalInsertionsWithModify:495 » IllegalArgument byt...
      TruthMaintenanceTest.testLogicalInsertionsUpdateEqual:703 » IllegalArgument by...
      TruthMaintenanceTest.testLogicalInsertionsNot:611 » IllegalArgument byte strea...

Note that exactly the same tests also fail when running the native Java compiler.

Comment 3 Mario Fusco 2014-03-19 12:42:36 UTC
I fixed the KnowledgeBuilderTest with these commits: 


I think the TruthMaintenanceTest are not real failures but only test issues causes by the comparison of the byte[] created by 2 subsequent serializations. We already experienced a similar problem migrating from Java6 to Java7.

Comment 4 Mario Fusco 2014-03-19 13:19:45 UTC
For now I ignored those serialization failures with this commit 


Anyway the generated byte[] or of the same size, so very likely the test failures are only caused by a different iteration order.

Comment 7 Mario Fusco 2014-03-24 08:51:53 UTC
I also updated the ASM version embedded in mvel, even if this is will be available only when I'll drop another release of mvel. Anyway this is not strictly necessary to make drools to run on Java 8 (even if it generates Java7 bytecode for now).

I am reassigning this ticket to Michael because, for what I know, at the moment there is an issue on drools-wb. This issue is mainly caused by the currently used version of GWT that doesn't provide Java8 support.

Comment 10 manstis 2014-12-18 10:24:26 UTC
I ran kie-wb and kie-drools-wb on EAP6.3 with Java 8 and (other than the above referenced bug - which is now fixed) found the workbenches to work OK (I only did a quick test and examination of the logs).

One issue I did notice is this:

10:12:39,813 INFO  [org.apache.sshd.common.util.SecurityUtils] (MSC service thread 1-9) BouncyCastle not registered, using the default JCE provider
10:12:42,081 INFO  [org.guvnor.m2repo.backend.server.GuvnorM2Repository] (MSC service thread 1-9) Maven Repository root set to: repositories/kie
10:12:42,081 INFO  [org.guvnor.m2repo.backend.server.GuvnorM2Repository] (MSC service thread 1-9) Creating Maven Repository root: repositories/kie
10:12:42,195 INFO  [org.jbpm.console.ng.asset.backend.server.AssetMgmtDeploymentUnitProvider] (MSC service thread 1-9) Found guvnor asset management deployment unit org.guvnor:guvnor-asset-mgmt-project:6.3.0-SNAPSHOT [strategy=SINGLETON] attempting to deploy it
10:12:44,988 ERROR [stderr] (MSC service thread 1-9) ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider com.sun.script.javascript.RhinoScriptEngineFactory not found
10:12:46,402 WARN  [org.jbpm.ruleflow.core.validation.RuleFlowProcessValidator] (MSC service thread 1-9) Process variable Data uses ObjectDataType for default type (java.lang) which could cause problems with setting variables, use dedicated type instead
10:12:46,636 WARN  [org.jbpm.ruleflow.core.validation.RuleFlowProcessValidator] (MSC service thread 1-9) Process variable Data uses ObjectDataType for default type (java.lang) which could cause problems with setting variables, use dedicated type instead

The ERROR is thrown when deploying the guvnor-asset-mgmt-project JAR to the jBPM runtime. I therefore assume (perhaps incorrectly) that there might be an issue with jBPM runtime and Java 8. 

Re-assigning to a jBPM developer for consideration.

Comment 11 Kris Verlaenen 2015-01-06 15:05:55 UTC
There seems to be a change in JS script engine between JDK7 and JDK8, and it's basically saying it can't find the JDK7 one on JDK8.  I don't think this is something we can fix in our code base.

Comment 12 Kris Verlaenen 2015-01-16 15:40:17 UTC
Since all work in our code base related to this is done, setting this one to MODIFIED.

Comment 13 Tibor Zimanyi 2015-03-09 12:07:38 UTC
Verified. I wrote a small JUnit test that used JDK8 and ran it with drools.dialect.java.compiler.lnglevel property set to 1.8.

Comment 14 Tibor Zimanyi 2015-03-09 12:20:55 UTC
Additional info: Drools and jBPM work on Java 8, but Java 8 syntax cannot be used in DRL rules. There is another Bugzilla ticket for this [1].

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1199965

Comment 15 JBoss JIRA Server 2015-08-10 06:48:30 UTC
Mario Fusco <mario.fusco@gmail.com> updated the status of jira DROOLS-329 to Resolved

Note You need to log in before you can comment on or make changes to this bug.