Solved!
I changed the accumulate function call for this one:
Number(intValue >= 1) from accumulate( fact() over window:time(1d) from
entry-point "MyEntryPoint", init( mytotal = 0; ),action( mytotal++;
),reverse( mytotal--; ),result( mytotal; ))
nestabur wrote:
Hi All,
I'm getting an error when firing the rule using the accumulate function:
Number(intValue >= 1) from accumulate( fact() over window:time(1d) from
entry-point "MyEntryPoint", init( int mytotal = 0; ),action( mytotal++;
),reverse( mytotal--; ),result( new Integer(mytotal) ))
The error is:
org.drools.RuntimeDroolsException: [Error: variable already defined within
scope: class java.lang.Integer mytotal]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0]
at org.drools.rule.Accumulate.init(Accumulate.java:144)
at
org.drools.reteoo.AccumulateNode.assertLeftTuple(AccumulateNode.java:142)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:117)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:28)
at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:175)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
at
org.drools.reteoo.PropagationQueuingNode$AssertAction.execute(PropagationQueuingNode.java:326)
at
org.drools.reteoo.PropagationQueuingNode.propagateActions(PropagationQueuingNode.java:221)
at
org.drools.reteoo.PropagationQueuingNode$PropagateAction.execute(PropagationQueuingNode.java:394)
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1486)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:158)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:122)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28)
at
com.s2grupo.triton.service.impl.TemporalCorrelatorServiceImpl.insertFact(TemporalCorrelatorServiceImpl.java:95)
at
com.s2grupo.triton.jms.impl.JmsMessageListenerImpl.onMessage(JmsMessageListenerImpl.java:98)
at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1021)
at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:122)
at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:192)
at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: [Error: variable already defined within scope: class
java.lang.Integer mytotal]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0]
at
org.drools.base.mvel.DroolsMVELFactory.createVariable(DroolsMVELFactory.java:252)
at
org.mvel2.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:68)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:107)
at org.mvel2.MVEL.executeExpression(MVEL.java:978)
at org.drools.base.mvel.MVELAccumulator.init(MVELAccumulator.java:134)
at org.drools.rule.Accumulate.init(Accumulate.java:138)
... 23 more
Could anyone help me?
Thanks,
Nestor
--
View this message in context:
http://www.nabble.com/Error-accumulate-function-tp25611774p25644055.html
Sent from the drools - user mailing list archive at
Nabble.com.