This is a known bug:
https://issues.jboss.org/browse/JBRULES-2962 Some
improvements were made in 5.3 and 5.4 but AFAIK, the issue still remains.
Could you please try using 5.4.SNAPSHOT ot beta1 to see if the error
persists?
Best Regards,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Developer @
http://www.plugtree.com
- Blog @
http://ilesteban.wordpress.com
On Mon, Jan 16, 2012 at 7:21 PM, lhorton <LHorton(a)abclegal.com> wrote:
Code level: 5.2.0.Final
I have a DRL file that includes a declared type:
package com.abclegal.rules.servicerequirements
declare TransgressionMetaData
attempt : ServiceAttempt
requirement : Requirement
end
The package loads the first time and its rules run without error. If I
make
a change to the file and hot-deploy it (copy it to the server), the
ResourceChangeScanner picks up the file and KnowledgeAgent loads it, but
when any rule from that package subsequently fires, I get a
ClassCastException on the declared type:
com.abclegal.rules.servicerequirements.TransgressionMetaData cannot be cast
to com.abclegal.rules.servicerequirements.TransgressionMetaData
it appears the KnowledgeAgent is not replacing the existing (in working
memory) definition of the declared type, but instead is creating a new one
with a different hash code.
looks like a bug?
Full stack trace:
Caused by: RulesConsequenceException executing consequence for rule
"PHOTO_WHEN_SERVED: Photo must be taken if served." in
com.abclegal.rules.servicerequirements
[Error: drools.insert(new TransgressionMetaData($attempt,$req)):
com.abclegal.rules.servicerequirements.TransgressionMetaData cannot be cast
to com.abclegal.rules.servicerequirements.TransgressionMetaData]
[Near : {... @Modify with($attempt){ ....}]
^
[Line: 1, Column: 1]
java.lang.ClassCastException:
com.abclegal.rules.servicerequirements.TransgressionMetaData cannot be cast
to com.abclegal.rules.servicerequirements.TransgressionMetaData
Rules working memory:
Fact ServiceAttempt id: 17
at
com.abclegal.rules.utility.RulesConsequenceExceptionHandler.handleException(RulesConsequenceExceptionHandler.java:24)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:912)
at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:845)
at
org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1056)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:733)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:699)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
at
org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:305)
at
com.abclegal.rules.server.RulesServiceImpl.execute(RulesServiceImpl.java:378)
... 44 more
Caused by: [Error: drools.insert(new TransgressionMetaData($attempt,$req)):
com.abclegal.rules.servicerequirements.TransgressionMetaData cannot be cast
to com.abclegal.rules.servicerequirements.TransgressionMetaData]
[Near : {... @Modify with($attempt){ ....}]
^
[Line: 1, Column: 1]
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:409)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:140)
at
org.mvel2.optimizers.dynamic.DynamicOptimizer.optimizeAccessor(DynamicOptimizer.java:67)
at org.mvel2.ast.ASTNode.optimize(ASTNode.java:154)
at
org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:110)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:86)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:122)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:115)
at org.mvel2.MVEL.executeExpression(MVEL.java:928)
at
org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:105)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:906)
... 51 more
Caused by: java.lang.reflect.InvocationTargetException
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.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1066)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:338)
... 61 more
--
View this message in context:
http://drools.46999.n3.nabble.com/ClassCastException-when-KnowledgeAgent-...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users