We are working with Drools version 6.2.0.Final for parsing some of our rules. But sometimes when we have a lot of runs, Drools invokes the JIT compiler which is causing failures. We have this covered in our Junit tests and we are getting the following error
java.lang.NoSuchMethodError: org.mvel2.compiler.BlankLiteral.<init>(Ljava/lang/String;)V
at ConditionEvaluatoref4dc802b6174038b0307f5e6196e229.evaluate(Unknown Source)
at org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:248)
at org.drools.core.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:204)
at org.drools.core.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
at org.drools.core.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:494)
at org.drools.core.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:384)
at org.drools.core.reteoo.ObjectTypeNode.propagateAssert(ObjectTypeNode.java:298)
at org.drools.core.phreak.PropagationEntry$Insert.execute(PropagationEntry.java:93)
at org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:96)
at org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:69)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.flushPropagations(StatefulKnowledgeSessionImpl.java:1993)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1289)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1294)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1281)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1260)
at org.drools.core.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:306)
We got this error in Java 7 as well but escaped this by using the option
KieBaseConfiguration kbConfig = KieServices.Factory.get().newKieBaseConfiguration();
kbConfig.setOption(PermGenThresholdOption.get(0));
Setting this option disabled JIT and our code was working fine. But since Java 8 has removed the PermGen option altogether, I am not able to figure out an option to achieve the same thing. This is causing the rules to fail when a lot of runs are executed.
I have tried a lot options to disable it but could not make it work.
- OptimizerFactory.setDefaultOptimizer(OptimizerFactory.SAFE_REFLECTIVE);
- System.setProperty("-Ddrools.dialect.java.compiler", "JANINO");
- System.setProperty("-Djava.compiler", "NONE");
- System.setProperty("-Dmvel2.disable.jit", "true");
- kbConfig.setOption(RuleEngineOption.PHREAK);
Some help will be really helpful.