problem when upgrading to 5.4.0.Final, got UnsupportedOperationException on an update call
by Michal Bali
Hi all,
I am upgrading an application from 5.3.0.Final to 5.4.0.Final and I am
getting the following exception:
Exception executing consequence for rule "ruleThatFails" in
indexingproblem.remove.me.anditworks:
java.lang.UnsupportedOperationException
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1212)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1446)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:674)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230)
at com.mycompany.app.IndexingProblemMain.main(IndexingProblemMain.java:36)
Caused by: java.lang.UnsupportedOperationException
at org.drools.reteoo.BaseLeftTuple.getPrevious(BaseLeftTuple.java:480)
at org.drools.core.util.index.LeftTupleList.remove(LeftTupleList.java:114)
at org.drools.core.util.index.LeftTupleList.removeAdd(LeftTupleList.java:68)
at org.drools.reteoo.JoinNode.modifyLeftTuple(JoinNode.java:310)
at
org.drools.reteoo.LeftTupleSource.doModifyLeftTuple(LeftTupleSource.java:304)
at
org.drools.reteoo.LeftTupleSource.modifyLeftTuple(LeftTupleSource.java:278)
at org.drools.reteoo.JoinNode.modifyLeftTuple(JoinNode.java:437)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateModifyLeftTuple(SingleLeftTupleSinkAdapter.java:205)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyObject(SingleLeftTupleSinkAdapter.java:235)
at
org.drools.reteoo.LeftInputAdapterNode.modifyObject(LeftInputAdapterNode.java:170)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateModifyObject(SingleObjectSinkAdapter.java:68)
at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:157)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:507)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:421)
at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:314)
at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:265)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:483)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:383)
at
org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:337)
at
indexingproblem.remove.me.anditworks.Rule_ruleThatFails_b159773c7b1a41a2a93044d2816b96ca.defaultConsequence(Rule_ruleThatFails_b159773c7b1a41a2a93044d2816b96ca.java:9)
at
indexingproblem.remove.me.anditworks.Rule_ruleThatFails_b159773c7b1a41a2a93044d2816b96caDefaultConsequenceInvokerGenerated.evaluate(Unknown
Source)
at
indexingproblem.remove.me.anditworks.Rule_ruleThatFails_b159773c7b1a41a2a93044d2816b96caDefaultConsequenceInvoker.evaluate(Unknown
Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1277)
... 6 more
I have tried to create a minimal test case that recreates this issue, here
it is:
package indexingproblem.remove.me.anditworks;
declare Criteria
processed : boolean
end
declare CheeseCriteria extends Criteria
end
rule setUp
salience 10000
when
then
insert(new CheeseCriteria());
end
rule aaa
when
CheeseCriteria( )
then
end
rule bbb
when
CheeseCriteria( )
then
end
rule ccc
when
CheeseCriteria( )
then
end
rule eeeFalse
when
Criteria( processed == false )
then
end
declare Filter
end
rule fffTrue
when
Criteria( processed == true )
Filter( )
then
end
rule ruleThatFails
when
$criteria : Criteria( processed == false )
then
modify($criteria) {
setProcessed(true)
}
end
I've tried to run it on 5.5.0-SNAPSHOT, but I got the same result. Note
that if you change the rule package to be "package indexingproblem" the
exception is not thrown. The code for building the KnowledgeBase is
standard, I haven't used any additional options. No fact is inserted only
one fireAllRules call.
Please let me know if I should create a new JIRA ticket for this or if I am
doing something wrong.
Thanking you in advance.
Best regards,
Michal
11 years, 7 months
Issue with From Clause - Class Cast Error
by tosmun
Hi All,
I am having a very strange issue with my knowledge base... I have the
following Rule:
...
rule "root_host"
no-loop true
ruleflow-group 'initialize-appliance-definitions'
when
$app:ApplianceType
(
type == ApplianceTypeIdentifier.APPLIANCE_ROOT
);
not( ApplianceTypeObject() from $app.getObjectTypes());
then
//Do something
end;
...
And the ApplianceType class is defined as:
...
public class ApplianceType
{
private ApplianceTypeIdentifier type;
private List<ApplianceTypeObject> objectTypes;
public ApplianceType(ApplianceTypeIdentifier type,
List<ApplianceTypeObject> initialObjectTypes)
{
this.type = type;
if(initialObjectTypes == null)
this.objectTypes = new ArrayList<ApplianceTypeObject>();
else
this.objectTypes = initialObjectTypes;
}
public ApplianceType(ApplianceTypeIdentifier type)
{
this(type, null);
}
public ApplianceTypeIdentifier getType()
{
return type;
}
public List<ApplianceTypeObject> getObjectTypes() {
return objectTypes;
}
}
When attempting to fireAllRules() I receive the following error:
...
Caused by: java.lang.ClassCastException: org.drools.reteoo.FromNode
incompatible with org.drools.reteoo.BetaNode
at org.drools.reteoo.ReteooBuilder.resetMasks(ReteooBuilder.java:303)
at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:267)
at org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:459)
at
org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:1107)
at
org.drools.common.AbstractRuleBase.mergePackage(AbstractRuleBase.java:851)
at
org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:610)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:472)
at
org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:150)
at
com.q1labs.frameworks.drools.DroolsEngine.getKnowledgeBase(DroolsEngine.java:139)
at com.q1labs.frameworks.drools.DroolsEngine.onInit(DroolsEngine.java:50)
at
com.q1labs.frameworks.naming.FrameworksNaming.initializeNewComponent(FrameworksNaming.java:951)
... 3 more
Any thoughts? I have been using from clauses just like this throughout my
project, and have had no issues with it to this point (even those which did
not use generics).
--
View this message in context: http://drools.46999.n3.nabble.com/Issue-with-From-Clause-Class-Cast-Error...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Classcast exception in Drools ant task
by Mutyala Suresh kumar
Hi All,
I am trying to build a sample drools project using ant and getting the below error. I am using "drools-distribution-5.4.0.Final" release jars in my project. Unable to get this issue resolved as not sure what really went wrong.
RuleBaseTask failed: Unable to load dialect 'org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration:mvel:org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration'
at org.drools.contrib.DroolsCompilerAntTask.execute(DroolsCompilerAntTask.java:159)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1307)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:33)
at org.apache.tools.ant.Project.executeTargets(Project.java:1191)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration:mvel:org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration'
at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:313)
at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:298)
at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:187)
at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:140)
at org.drools.contrib.DroolsCompilerAntTask.getPackageBuilder(DroolsCompilerAntTask.java:556)
at org.drools.contrib.DroolsCompilerAntTask.createWithPackageBuilder(DroolsCompilerAntTask.java:266)
at org.drools.contrib.DroolsCompilerAntTask.execute(DroolsCompilerAntTask.java:156)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
... 2 more
Caused by: java.lang.ClassCastException: org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration
at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:308)
at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:298)
at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:189)
at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:142)
at org.drools.contrib.DroolsCompilerAntTask.getPackageBuilder(DroolsCompilerAntTask.java:558)
at org.drools.contrib.DroolsCompilerAntTask.createWithPackageBuilder(DroolsCompilerAntTask.java:266)
at org.drools.contrib.DroolsCompilerAntTask.execute(DroolsCompilerAntTask.java:156)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1307)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:33)
at org.apache.tools.ant.Project.executeTargets(Project.java:1191)
... 2 more
Below is the list of jars added to my classpath,
--------------------------------------------
antlr-runtime.jar
drools-ant-5.4.0.Final.jar
drools-compiler-5.4.0.Final.jar
drools-core-5.4.0.Final.jar
drools-decisiontables-5.4.0.Final.jar
drools-jsr94-5.4.0.Final.jar
drools-persistence-jpa-5.4.0.Final.jar
drools-templates-5.4.0.Final.jar
drools-verifier-5.4.0.Final.jar
droolsjbpm-ide-common-5.4.0.Final.jar
jbpm-bpmn2.jar
jbpm-flow-builder.jar
jbpm-flow.jar
jsr94.jar
junit.jar
jxl.jar
knowledge-api.jar
knowledge-internal-api.jar
mvel2.jar
org.eclipse.jdt.core_3.6.1.v_A68_R36x.jar
xmlpull.jar
xpp3_min.jar
xstream.jar
build.xml
---------
<project name="DroolsProto" default="dist" basedir=".">
<property name="build.src" location="src"/>
<property name="build.target" location="target"/>
<property name="build.dist" location="dist"/>
<path id="build.lib.path">
<fileset dir="${build.src}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<taskdef name="droolscompiler" classname="org.drools.contrib.DroolsCompilerAntTask">
<classpath refid="build.lib.path"/>
</taskdef>
<target name="clean">
<delete dir="${build.target}"/>
<delete dir="${build.dist}"/>
</target>
<target name="init">
<tstamp/>
<mkdir dir="${build.target}"/>
<mkdir dir="${build.dist}"/>
<record name="build.log" loglevel="verbose" append="false"/>
</target>
<target name="compile" depends="init">
<mkdir dir="${build.target}/classes"/>
<javac srcdir="${build.src}/main/java" destdir="${build.target}/classes">
<classpath refid="build.lib.path"/>
<include name="**/*.java"/>
</javac>
</target>
<target name="compile-rules">
<property name="pathelements" refid="build.lib.path"/>
<droolscompiler srcDir="${build.src}/main/rules"
toFile="${build.target}/classes/drl.pkg"
classpathref="build.lib.path">
<include name="*.drl" />
</droolscompiler>
</target>
<target name="bundle-resources" depends="compile-rules">
<copy todir="${build.target}/classes">
<fileset dir="${build.src}/main/resources"/>
</copy>
</target>
<target name="dist" depends="compile,bundle-resources"/>
</project>
Thanks in advance,
Suresh
11 years, 7 months
planning difficulty problem
by Ricardo
For example , I have 10 doctors planning for 3 hospitals in three shifts,
each hospital take maximum limit of 3 doctors only, In this case I have one
remaining doctor unassigned. My doubt is how planner handle this data? will
it be rejected or consider in other cycle or overwrite the planner solution?
please advise...
thanks,
-----
with kind regards,
--
View this message in context: http://drools.46999.n3.nabble.com/planning-difficulty-problem-tp4019857.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Persistence in fireUntilHalt() loop
by Alberto R. Galdo
Hi,
We're running an application that uses Drools + JBPM 5 + Drools
integration our set-up can be seen as:
Some rule fires and creates a JBPM process ( a fact gets inserted into
drools using "kcontext.getKnowledgeRuntime().startProcess("testProcess")"
). We have a problem with the persistence of this processes. Persistence is
implemented with JPA and JTA. Our application runs with fireUntilHalt() and
when a process is launched from the consequence of any of the rules the
persistence of the process fails. If the application runs with
fireAllRules(), the persistence works like a charm.
The error shown is as follow:
Exception in thread "Thread-5" Exception executing consequence for rule
"Run Process" in com.sample: java.lang.NullPointerException
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
at org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1229)
at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:754)
at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:730)
at
org.drools.command.runtime.rule.FireUntilHaltCommand$1.run(FireUntilHaltCommand.java:50)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
at
org.jbpm.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:44)
at
org.jbpm.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:36)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:182)
at
org.jbpm.process.instance.ProcessRuntimeImpl.createProcessInstance(ProcessRuntimeImpl.java:154)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:135)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:130)
at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1074)
at
org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:301)
at com.sample.Rule_Run_Process.defaultConsequence(Rule_Run_Process.java:9)
at com.sample.Rule_Run_ProcessDefaultConsequenceInvoker.evaluate(Unknown
Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
... 6 more
The problem is in this function:
public void addProcessInstance(ProcessInstance processInstance) {
ProcessInstanceInfo processInstanceInfo = new ProcessInstanceInfo(
processInstance, this.kruntime.getEnvironment() );
ProcessPersistenceContext context
= ((ProcessPersistenceContextManager)
this.kruntime.getEnvironment()
.get( EnvironmentName.PERSISTENCE_CONTEXT_MANAGER ))
.getProcessPersistenceContext();
// @PrePersist added to ProcessInstanceInfo because of this
context.persist( processInstanceInfo );
((org.jbpm.process.instance.ProcessInstance)
processInstance).setId( processInstanceInfo.getId() );
processInstanceInfo.updateLastReadDate();
internalAddProcessInstance(processInstance);
}
We think after that persist sentence, the entity manager would have to run
a flush sentence for the process instance is inserted into database and get
the ID.
Greets.
11 years, 7 months
Re: [rules-users] exception jitting problem
by Mario Fusco
brendanneff wrote
>
> I read a few forum posts about updating to 5.4 CR1 (we're using 5.4
> Final), but wanted to ask and see if that's really the cause before I
> start changing the version. I also saw that casting as an Integer, which
> we do, could solve the problem. Could someone take a look at this and let
> me know if changing to CR1 would fix the issue or if there's a simpler
> solution?
>
I am afraid you misread some former email. I think nobody wrote (or at least
I couldn't find it) that using the 5.4.CR1 release instead of the 5.4.Final
could fix this problem. Quite the opposite actually. I fixed some of these
jitting issues we had between the CR1 and the Final and some others
(including the one you found) remained even in the Final release.
I think I've fixed all the outstanding jitting issues and these fixes will
be available in the upcoming 5.5 release (we are deploying the beta1 in
these days). However it would be great if I could reproduce the bugs you
found, both because I could check if they are actually fixed in the 5.5 and
possibly give you some more informed suggestions to workaround them in the
5.4. In order to do that, the only info I miss is how the CMVNewLoanBean
class is made. Could you please send its source code (or at least the parts
relevant for the 2 failing rules you have) ?
brendanneff wrote
>
> Here are the rules that seem to be causing the errors:
>
> rule "Cashcure - Average Monthly Income Less Than 1251"
> when
> $loan : CMVNewLoanBean( new
> Integer(getCustomer().getLatestEmployer().monthlySalary) < 1251)
> then
> $loan.setLenderError($loan.getCurrentLender().getName(), 20253);
> end
>
Out of curiosity, why do you create the new Integer there instead of just
doing:
CMVNewLoanBean( getCustomer().getLatestEmployer().monthlySalary < 1251)
Thanks for reporting this,
Mario
--
View this message in context: http://drools.46999.n3.nabble.com/exception-jitting-problem-tp4019763p401...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months