Bug 1078146 - Drools and jBPM 6.0 should work on Java 8
Summary: Drools and jBPM 6.0 should work on Java 8
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ER5
: 6.1.0
Assignee: Kris Verlaenen
QA Contact: Tibor Zimanyi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-19 09:14 UTC by Geoffrey De Smet
Modified: 2020-03-27 19:07 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1091383 (view as bug list)
Environment:
Last Closed: 2020-03-27 19:07:34 UTC
Type: Feature Request
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1174202 0 urgent CLOSED LuceneIndexEngine throws "Index fails - NPE" on jvm v8 2021-02-22 00:41:40 UTC
Red Hat Issue Tracker DROOLS-329 0 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:
  http://stackoverflow.com/questions/22493865/why-isnt-maven-working-with-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:
  https://blogs.oracle.com/java/entry/java_se_8_is_now

Requirements:
  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:

https://github.com/droolsjbpm/droolsjbpm-build-bootstrap/commit/498d0b390
https://github.com/droolsjbpm/drools/commit/2eaaf8750

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: 

https://github.com/droolsjbpm/drools/commit/c88626c77dff0ef5c56deea6de3fe9dd8581488d
https://github.com/droolsjbpm/drools/commit/d87f305ee651846785b5ee47135241d2a49cdb7a

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 

https://github.com/droolsjbpm/drools/commit/c7af96d1e

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.
https://issues.jboss.org/browse/WFLY-3991

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> 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.