Bug 818843

Summary: Seam 2.2 Drools doesn't work with Java 7
Product: [Retired] JBoss Enterprise WFK Platform 2 Reporter: Marek Schmidt <maschmid>
Component: SeamAssignee: Marek Novotny <mnovotny>
Status: CLOSED CANTFIX QA Contact:
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 2.0.0.GACC: rnewton
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: Seam2.2
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Seam 2.2 Drools and Java 7 are incompatible and fail with an org.drools.RuntimeDroolsException: value '1.7' is not a valid language level error.
Story Points: ---
Clone Of: Environment:
Seam2.2.5.EAP5, EAP 6.0.0.ER6
Last Closed: 2012-06-18 15:32:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marek Schmidt 2012-05-04 07:29:35 UTC
Description of problem:

Seam2.2 drools component fails on Java 7 with

"org.drools.RuntimeDroolsException: value '1.7' is not a valid language level"

Version-Release number of selected component (if applicable):

Seam2.2.5.EAP5

How reproducible:

Always


Steps to Reproduce:
1. use jdk7
2. build seam drools example 
3. deploy seam drools example on EAP6
4. go to http://127.0.0.1:8080/seam-drools
5. pick a guess
  
Actual results:

An error page is displayed

Expected results:

No error

Additional info:

Comment 1 Rebecca Newton 2012-05-14 04:21:40 UTC
Thanks for the bug. Please check the accuracy of the draft tech note.

Comment 2 Rebecca Newton 2012-05-14 04:21:40 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Seam 2.2 Drools and Java 7 are incompatible and fail with an org.drools.RuntimeDroolsException: value '1.7' is not a valid language level error.

Comment 3 JBoss JIRA Server 2012-06-04 06:13:42 UTC
Marek Novotny <mnovotny> made a comment on jira JBPAPP-8915

Tech note is accurate, thanks Becca!

Comment 4 mark yarborough 2012-06-18 15:32:14 UTC
WFK 2.0 does not delivere Seam 2.2, however, these issues have already been documented in the EAP 6 release notes, so no need to duplicate each issue in WFk 2.0 release notes. However, we should include a pointer to the EAP 6 release notes to assist customers looking for Seam 2.2 bug information.

Comment 5 JBoss JIRA Server 2012-07-25 11:43:13 UTC
Marek Novotny <mnovotny> made a comment on jira JBPAPP-8915

Drools compiler has got hard-coded language level :-(

Comment 6 JBoss JIRA Server 2012-07-25 11:44:34 UTC
Marek Novotny <mnovotny> made a comment on jira JBPAPP-8915

Drools compiler has got hard-coded language level :-(

http://anonsvn.jboss.org/repos/labs/labs/jbossrules/tags/5.1.1.34858.FINAL/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectConfiguration.java
{code:java}
public static final String[]        LANGUAGE_LEVELS = new String[]{"1.5", "1.6"};
{code}

Comment 7 JBoss JIRA Server 2012-07-26 15:04:08 UTC
Tihomir Surdilovic <tsurdilo> made a comment on jira JBPAPP-8915

Language Level 1.7 was added as part of Jira https://issues.jboss.org/browse/JBRULES-2439 per support ticket https://enterprise.redhat.com/issue-tracker/565153. A .Final fix version for this should be 5.1.0.Final Drools. 

What is the current version of Drools used in Seam 2.2?

Comment 8 JBoss JIRA Server 2012-07-27 06:12:01 UTC
Marek Novotny <mnovotny> made a comment on jira JBPAPP-8915

Tihomir, 
Seam 2.2 uses 5.1.0.BRMS. That can be seen in above error stack trace

{noformat}
at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.getDefaultLanguageLevel(JavaDialectConfiguration.java:162) [drools-compiler.jar:5.1.0.BRMS]
{noformat}

Comment 9 JBoss JIRA Server 2012-07-27 06:21:07 UTC
Marek Novotny <mnovotny> made a comment on jira JBPAPP-8915

I looked at 5.1.0.BRMS sources (they are available here http://download.devel.redhat.com/brewroot/repos/mead-shared-build/latest/maven/org/drools/drools-compiler/5.1.0.BRMS/drools-compiler-5.1.0.BRMS-sources.jar) and they don't have any differences between 5.1.0.Final in the JavaDialectConfiguration class.

Anyway I think there is required to fix these lines too starting from line #160:
{code:java}
if ( Arrays.binarySearch( LANGUAGE_LEVELS,
                                  level ) < 0 ) {
            throw new RuntimeDroolsException( "value '" + level + "' is not a valid language level" );
        }
{code}

As there is check with the array which is defined like
{code:java}
public static final String[]        LANGUAGE_LEVELS = new String[]{"1.5", "1.6"};
{code}

Comment 10 JBoss JIRA Server 2012-07-27 12:45:34 UTC
Tihomir Surdilovic <tsurdilo> made a comment on jira JBPAPP-8915

Thanks Marek - using 5.2.0 BRMS would not be an option?

Comment 11 JBoss JIRA Server 2012-07-27 13:34:19 UTC
Marek Novotny <mnovotny> made a comment on jira JBPAPP-8915

That is the issue as 5.1.x to 5.2.x is not straightforward.

Drools 5.2 changed mvel parser and API changes are there, there is needed migration in mvel rules and EAP 5 requires backward compatibility.

Comment 12 JBoss JIRA Server 2012-07-27 18:26:50 UTC
Mark Proctor <mproctor> made a comment on jira JBPAPP-8915

There should be no incompatability at the DRL level between 5.2.x and 5.2.x. Compiled packages are not compatible, but BRMS has a recompile all button.

Comment 13 JBoss JIRA Server 2012-07-27 18:27:41 UTC
Mark Proctor <mproctor> made a comment on jira JBPAPP-8915

Aslo as long as you are only using interfaces from -api, there is no breakages at an API level.

Comment 14 JBoss JIRA Server 2012-07-30 08:19:20 UTC
Marek Novotny <mnovotny> made a comment on jira JBPAPP-8915

Not sure that I recognize Drools API correctly in Seam usage.

What I can see that I tried already to migrate in Seam product branch for WFK and there is needed to use org.drools.event.process.ProcessEventListener instead of org.drools.event.RuleFlowEventListener. That seems easy, but there are also required to migrate rules. Look at one example of migrated security-rules.drl at https://source.jboss.org/changelog/Seam?cs=14910

Comment 15 JBoss JIRA Server 2012-08-02 04:48:32 UTC
Alessandro Lazarotti <alazarot> made a comment on jira JBPAPP-8915

Hi Marek,
I've just created the tag https://svn.jboss.org/repos/labs/labs/jbossrules/soa_tags/BRMS-5.1-GA-JBPAPP-8915/
It contains the drools source code used by Seam 2.2.2.EAP5 + the JavaDialectConfiguration fix.

I did some initial tests and it is working as expected.


PS: I've seen your tests using WFK2.0. The change of "->" to "," is very old. The first one is a very old style used by Drools4< and I've never seen any user using it on Drools 5. I am surprise that it was working until Drools 5.1. The second change, casting the parameter in the condition part (LHS) is necessary because drools is using MVEL as strict mode (type safe) on Drools 5.2. I did not test your use case, but you can try setting drools.dialect.mvel.strict to false (by system properties), this should avoid your cast in the LHS.

Comment 16 JBoss JIRA Server 2012-08-02 13:45:47 UTC
Marek Novotny <mnovotny> made a comment on jira JBPAPP-8915

Alessandro, I tried your patch on patched EAP 5.1.2 with jdk7 update and it is still an issue, even it throws different exception in different class.

{noformat}
org.jbpm.graph.def.DelegationException: no applicable exception handler found
	at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:368)
	at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:362)
	at org.jbpm.graph.node.Decision.handleDecision(Decision.java:168)
	at org.jbpm.graph.node.Decision.execute(Decision.java:95)
	at org.jbpm.graph.def.Node.enter(Node.java:381)
	at org.jbpm.graph.def.Transition.take(Transition.java:162)
	at org.jbpm.graph.def.Node.leave(Node.java:450)
	at org.jbpm.graph.exe.Token.signal(Token.java:210)
	at org.jbpm.graph.exe.Token.signal(Token.java:171)
	at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:291)
	at org.jboss.seam.pageflow.Pageflow.signal(Pageflow.java:485)
	at org.jboss.seam.pageflow.Pageflow.navigate(Pageflow.java:341)
	at org.jboss.seam.jsf.SeamNavigationHandler.handleNavigation(SeamNavigationHandler.java:40)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
	at javax.faces.component.UICommand.broadcast(UICommand.java:387)
	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
	at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.internalProcess(ActiveRequestResponseCacheValve.java:74)
	at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:47)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
	at java.lang.Thread.run(Thread.java:722)
Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: ruleBase
	at org.jboss.seam.Component.newInstance(Component.java:2197)
	at org.jboss.seam.Component.getInstance(Component.java:2021)
	at org.jboss.seam.Component.getInstance(Component.java:1983)
	at org.jboss.seam.Component.getInstance(Component.java:1977)
	at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
	at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
	at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148)
	at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51)
	at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
	at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
	at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
	at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
	at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:157)
	at org.jboss.seam.drools.ManagedWorkingMemory.getRuleBaseFromValueBinding(ManagedWorkingMemory.java:125)
	at org.jboss.seam.drools.ManagedWorkingMemory.getStatefulSession(ManagedWorkingMemory.java:76)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
	at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
	at org.jboss.seam.Component.callComponentMethod(Component.java:2302)
	at org.jboss.seam.Component.unwrap(Component.java:2328)
	at org.jboss.seam.Component.getInstance(Component.java:2041)
	at org.jboss.seam.Component.getInstance(Component.java:1983)
	at org.jboss.seam.Component.getInstance(Component.java:1977)
	at org.jboss.seam.drools.DroolsHandler.getWorkingMemory(DroolsHandler.java:25)
	at org.jboss.seam.drools.DroolsDecisionHandler.decide(DroolsDecisionHandler.java:26)
	at org.jbpm.graph.node.Decision.handleDecision(Decision.java:165)
	... 54 more
Caused by: java.lang.RuntimeException: unknown version 1.7
	at org.drools.commons.jci.compilers.EclipseJavaCompilerSettings.toNativeVersion(EclipseJavaCompilerSettings.java:96)
	at org.drools.commons.jci.compilers.EclipseJavaCompilerSettings.toNativeSettings(EclipseJavaCompilerSettings.java:107)
	at org.drools.commons.jci.compilers.EclipseJavaCompilerSettings.<init>(EclipseJavaCompilerSettings.java:73)
	at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:127)
	at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
	at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
	at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
	at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
	at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:677)
	at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:640)
	at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:254)
	at org.jboss.seam.drools.RuleBase.compileRuleBase(RuleBase.java:75)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
	at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
	at org.jboss.seam.Component.callComponentMethod(Component.java:2302)
	at org.jboss.seam.Component.callCreateMethod(Component.java:2225)
	at org.jboss.seam.Component.newInstance(Component.java:2185)
	... 82 more
{noformat}

Comment 17 JBoss JIRA Server 2012-08-02 14:12:05 UTC
Alessandro Lazarotti <alazarot> made a comment on jira JBPAPP-8915

damn jdt! I am seeing the error. I was testing using compliance level 1.6
At EclipseJavaCompilerSettings.java the 1.7 is not included in "nativeVersions" (even though declared as CompilerOptions_VERSION_1_7).
I will commit it in moments

Comment 18 JBoss JIRA Server 2012-08-02 14:19:16 UTC
Marek Novotny <mnovotny> made a comment on jira JBPAPP-8915

so basically the following patch as additional change works fine for me

{noformat}
ndex: drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java
===================================================================
--- drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java   (revision 38159)
+++ drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java   (working copy)
@@ -87,6 +87,7 @@
      put("1.4", CompilerOptions_VERSION_1_4);^M
      put("1.5", CompilerOptions_VERSION_1_5);^M
      put("1.6", CompilerOptions_VERSION_1_6);^M
+     put("1.7", CompilerOptions_VERSION_1_6);^M
     }};^M
     ^M
     private String toNativeVersion( final String pVersion ) {^M

{noformat}

Will you change also the version from 5.1.0.BRMS?

Comment 19 JBoss JIRA Server 2012-08-02 14:40:51 UTC
Alessandro Lazarotti <alazarot> made a comment on jira JBPAPP-8915

I just committed this on https://svn.jboss.org/repos/labs/labs/jbossrules/soa_tags/BRMS-5.1-GA-JBPAPP-8915/
I will not change the other tag (soa_tags/BRMS-5.1-GA), it is better stay as it was released. This new one is like a patched branch for a single-fix.

IMHO Seam should use it and declare as frozen the supported Drools version. Unless a refactor about the Drools integration be done. Today Seam uses the Drools 4 API (does not use Knowledge API), a lot of methods there is deprecated. I am not sure if the current drools-seam-integration will be working in the next major BRMS releases.

Comment 20 JBoss JIRA Server 2012-08-02 17:25:35 UTC
Marek Novotny <mnovotny> made a comment on jira JBPAPP-8915

alessandro, 
we don't understand here to each other, I don't want to change the soa_tags/BRMS-5.1-GA tag. But we need for a new build different version not 5.1.0.BRMS, that artifacts are already built. Maven builds requires a new version, that is not that you can overwrite existing artifact. Maven artifacts are immutable.

My suggestion is something like 5.1.0.BRMS-jdk7 instead of 5.1.0.BRMS. This doesn't relate to changing usage of Drools APIs in Seam at all.

Comment 21 JBoss JIRA Server 2012-08-03 04:49:00 UTC
Alessandro Lazarotti <alazarot> made a comment on jira JBPAPP-8915

I thought that was about it right after I commented here, reading the thread by email.
Ok, I will do.

Comment 22 JBoss JIRA Server 2012-08-03 10:22:32 UTC
Marek Novotny <mnovotny> made a comment on jira JBPAPP-8915

Alessandro,

 please let Doug Palmer know, when the tag is ready. He will do the build of Drools.

Comment 23 JBoss JIRA Server 2012-08-03 14:02:57 UTC
Alessandro Lazarotti <alazarot> made a comment on jira JBPAPP-8915

Done

Comment 24 JBoss JIRA Server 2012-08-03 20:23:45 UTC
Marek Novotny <mnovotny> updated the status of jira JBPAPP-8915 to Resolved

Comment 25 JBoss JIRA Server 2012-08-03 20:23:45 UTC
Marek Novotny <mnovotny> made a comment on jira JBPAPP-8915

Seam was updated to Drools 5.1.0.BRMS-jdk7

Comment 26 JBoss JIRA Server 2012-09-06 10:51:16 UTC
Marek Schmidt <maschmid> updated the status of jira JBPAPP-8915 to Closed

Comment 27 JBoss JIRA Server 2012-09-06 10:51:16 UTC
Marek Schmidt <maschmid> made a comment on jira JBPAPP-8915

Verified on EAP 5.2.0.ER2

Comment 28 JBoss JIRA Server 2012-10-30 00:37:53 UTC
Russell Dickenson <rdickens> updated the status of jira JBPAPP-8915 to Reopened

Comment 29 JBoss JIRA Server 2012-10-30 00:37:53 UTC
Russell Dickenson <rdickens> made a comment on jira JBPAPP-8915

Issue reopened to change Release Notes field.

Comment 30 JBoss JIRA Server 2012-10-30 00:39:42 UTC
Russell Dickenson <rdickens> updated the status of jira JBPAPP-8915 to Closed