| Summary: | NullPointerException when executing SetGlobalCommand with BatchExecutionCommand when using JPAKnowledgeService.newStatefulKnowledgeSession() | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise BRMS Platform 5 | Reporter: | Tomas Schlosser <tschloss> | ||||
| Component: | BRE (Expert, Fusion) | Assignee: | Nobody <nobody> | ||||
| Status: | VERIFIED --- | QA Contact: | Lukáš Petrovický <lpetrovi> | ||||
| Severity: | high | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | BRMS 5.2.0.GA | CC: | rzhang | ||||
| Target Milestone: | --- | ||||||
| Target Release: | BRMS 5.3.0.GA | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: |
When trying to execute BatchExecutionCommand on a persisted StatefulKnowledgeSession a Null Pointer Exception was thrown. The issue has been resolved by replacing the JPAKnowledgeService.newStatefulKnowledgeSession(kbase, ksconf, env) method, with the kbase.newStatefulKnowledgeSession() method.
|
Story Points: | --- | ||||
| Clone Of: | Environment: | ||||||
| Last Closed: | Type: | Bug | |||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Attachments: |
|
||||||
Would it be possible to add a pom.xml file or all libraries in future reproducer attachments? The missing libraries make it hard to reproduce. With drools 5.4.0-SNAPSHOT I am getting this:
{code}
Exception in thread "main" [Error: unable to resolve method: org.jboss.qa.brms.persistencequery.Fact.name__() [arglength=0]]
[Near : {... name == name__ ....}]
^
[Line: 1, Column: 1]
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1068)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:982)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:677)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanPropertyAO(ReflectiveAccessorOptimizer.java:474)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:372)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:141)
at org.mvel2.optimizers.dynamic.DynamicOptimizer.optimizeAccessor(DynamicOptimizer.java:67)
at org.mvel2.ast.ASTNode.optimize(ASTNode.java:157)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:113)
at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:116)
at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42)
at org.mvel2.MVEL.executeExpression(MVEL.java:922)
at org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:34)
at org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:30)
at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:132)
at org.drools.rule.constraint.MvelConstraint.isAllowedCachedLeft(MvelConstraint.java:101)
at org.drools.common.DoubleNonIndexSkipBetaConstraints.isAllowedCachedLeft(DoubleNonIndexSkipBetaConstraints.java:136)
at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:103)
at org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:232)
at org.drools.reteoo.CompositeLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:118)
at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:158)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:134)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:211)
at org.drools.reteoo.EntryPointNode.assertQuery(EntryPointNode.java:146)
at org.drools.reteoo.ReteooWorkingMemory.getQueryResults(ReteooWorkingMemory.java:195)
at org.drools.impl.StatefulKnowledgeSessionImpl.getQueryResults(StatefulKnowledgeSessionImpl.java:770)
at org.drools.command.runtime.rule.QueryCommand.execute(QueryCommand.java:105)
at org.drools.command.runtime.rule.QueryCommand.execute(QueryCommand.java:37)
at org.drools.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:155)
at org.drools.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:76)
at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:358)
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.execute(CommandBasedStatefulKnowledgeSession.java:482)
at org.jboss.qa.brms.persistencequery.PersistenceQueryTest.main(PersistenceQueryTest.java:46)
{code}
In drools 5.3.2-SNAPSHOT I am also getting the NPE. The ReflectiveAccessorOptimizer stacktrace might be a different regression in 5.4 related to the MVEL optimization work. It looks like the ruleset.drl is invalid. Instead of follows( $middle, next; ) it should be ?follows( $middle, next; ) Changing that does not prevent the NPE in 5.3. It probably fixes the ReflectiveAccessorOptimizer in 5.4 (causing an NPE there too?). This has nothing to do with the backwards chaining query.
I reproduced it with
commands.add(CommandFactory.newSetGlobal("foobar", "boe", true));
with drools 5.4.0-SNAPSHOT.
The problem is the use of
JPAKnowledgeService.newStatefulKnowledgeSession(kbase, ksconf, env)
Replacing that by
kbase.newStatefulKnowledgeSession();
stops the issue from occurring.
I recreated a testcase inside drools-persistence-jpa which only uses SetGlobalCommand: org.drools.persistence.map.impl.JpaBasedPersistenceTest#testSetGlobalWithJPAKnowledgeService It's @Ignored atm. The issue is fixed.
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:
When trying to execute BatchExecutionCommaind on a persisted StatefulKnowledgeSession a Null Pointer Exception is thrown.
Technical note updated. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
Diffed Contents:
@@ -1 +1 @@
-When trying to execute BatchExecutionCommaind on a persisted StatefulKnowledgeSession a Null Pointer Exception is thrown.+When trying to execute BatchExecutionCommand on a persisted StatefulKnowledgeSession a Null Pointer Exception was thrown. The issue has been resolved by replacing the JPAKnowledgeService.newStatefulKnowledgeSession(kbase, ksconf, env) method, with the kbase.newStatefulKnowledgeSession() method.
|
Created attachment 527952 [details] Simple reproducer Description of problem: When trying to execute BatchExecutionCommaind on persisted StatefulKnowledgeSession I get NPE. Version-Release number of selected component (if applicable): BRMS-5.2.0.CR1 How reproducible: Every time. Steps to Reproduce: 1. run included reproducer Actual results: Exception in thread "main" java.lang.NullPointerException at org.drools.command.runtime.rule.QueryCommand.execute(QueryCommand.java:107) at org.drools.command.runtime.rule.QueryCommand.execute(QueryCommand.java:36) at org.drools.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:155) at org.drools.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:76) at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36) at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:331) at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.execute(CommandBasedStatefulKnowledgeSession.java:481) at org.jboss.qa.brms.persistencequery.PersistenceQueryTest.main(PersistenceQueryTest.java:46) Expected results: succesful run Additional info: