hi Edson.
This is in continuation with the below issue that I had posted a few months
back. Even though we removed Spring AOP from the application then, the
problem still occurs at times. I was wondering if Hibernate was the culprit,
but fail to understand why it is not consistently happening.
The Inventory object which is causing the ClassCastException is a Hibernate
proxy since it is lazy loaded. The injected fact contains a reference to
this Inventory. So I was wondering if the issue has something to do with
shadow fact creation. When the shadow is created for a fact that contains a
Hibernate proxy, is there any possibility of this problem?
Thanks,
Seema
Edson Tirelli-3 wrote:
Hi Seema,
Your rules look fine, and the reason you see an "eval" in the
exception
text is that this:
inventory.leaseInformation != null
Is resolved as an eval.
Anyway, drools does *not* use CGLIB. We generate bytecode directly
using ASM. No CGLIB in the middle.
The problem, whatever it is, is related to the pojo model and any of
these frameworks interfering with it. So, if you can create an isolated
test
case that allow us to reproduce the problem, it will help us understand
how
can we support your scenario of usage.
Thanks,
Edson
2008/11/26 seemamani <seemamani(a)gmail.com>
>
> Edson,
>
> We are not sure how the CGLIB proxy is getting created. We were under the
> impression that it is the shadow fact proxy generated by Drools itself. I
> would like to share a few more points about our application in case they
> are
> somehow related to this problem.
>
> 1. We are using Spring AOP for intercepting method calls and passing the
> facts, globals etc to a class that invoke Drools. Version of Spring is
> 2.0.7
> 2. We are using Hibernate 3.x/JPA for persistence. In fact the Inventory
> POJO that is causing the ClassCastException is a JPA entity
> 3. We have rules defined in multiple packages. The Inventory POJO is used
> by
> rules in all the packages. But the exception is occurring only for rules
> in
> a particular package. That too only occasionally.
>
> Please let me know if any other information is required.
>
> Thanks,
> Seema
>
>
> Edson Tirelli-3 wrote:
> >
> > What are you guys doing with CGLIB? or is this WebSphere doing some
> > sneaky thing behind the scenes? Or is it SpringAOP doing sneaky things?
> >
> > Caused by:
> > java.lang.ClassCastException: com.adesa.data.grounding.pojo.Inventory
> > incompatible with
> > com.adesa.data.grounding.pojo.Inventory$$EnhancerByCGLIB$$de81aab3
> >
> > At compile time we determine that "inventory" is a
> > com.adesa.data.grounding.pojo.Inventory. If at runtime what arrives
> into
> > the
> > expression is a
> > com.adesa.data.grounding.pojo.Inventory$$EnhancerByCGLIB$$de81aab3,
> > and it is not a proper subclass, you might get such problems.
> >
> > Having said that, I will talk to Mike to check if this can be
> prevented
> > somehow, but I really don't know if it will be possible...
> >
> > []s
> > Edson
> >
> >
> >
> > 2008/11/25 seemamani <seemamani(a)gmail.com>
> >
> >>
> >> hi,
> >>
> >> We are using Drools 4.0.7 in a web application deployed in WebSphere
> 6.1.
> >> Occasionally, we have rule engine failure caused by
> >> RuntimeDroolsException
> >> (whose root cause is shown as ClassCastException) when firing rules.
> >> Other
> >> times, the rules are executing without errors. Here is the stack trace
> of
> >> the exception. What are the possible reasons?
> >>
> >> Thanks,
> >> Seema
> >>
> >> org.drools.RuntimeDroolsException: Exception executing predicate eval(
> >> inventory.leaseInformation != null )
> >> at
> >>
> org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216)
> >> at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
> >> at
> >>
> >>
>
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
> >> at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
> >> at
> >>
> >>
>
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
> >> at
> >> org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
> >> at org.drools.reteoo.Rete.assertObject(Rete.java:175)
> >> at
> >> org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
> >> at
> >>
> org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
> >> at
> >>
> >>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:911)
> >> at
> >>
> >>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)
> >> at
> >>
> >>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:684)
> >> at
> >>
> >>
>
com.adesa.business.framework.rules.process.drools.ManagedStatefulSession.init(ManagedStatefulSession.java:87)
> >> at
> >>
> >>
>
com.adesa.business.framework.rules.process.drools.ManagedStatefulSession.fireAllRules(ManagedStatefulSession.java:100)
> >> at
> >>
> >>
>
com.adesa.business.framework.rules.process.drools.RuleEngineImpl.execute(RuleEngineImpl.java:60)
> >> at
> >>
> >>
>
com.adesa.business.framework.rules.interceptor.RulesInterceptor.applyAnnotedRules(RulesInterceptor.java:109)
> >> at
> >>
> >>
>
com.adesa.business.framework.rules.interceptor.RulesInterceptor.applyRules(RulesInterceptor.java:80)
> >> at sun.reflect.GeneratedMethodAccessor575.invoke(Unknown
> Source)
> >> at
> >>
> >>
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >> at java.lang.reflect.Method.invoke(Method.java:618)
> >> at
> >>
> >
> >>
>
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:597)
> >> at
> >>
> >>
>
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:583)
> >> at
> >>
> >>
>
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:60)
> >> at
> >>
> >>
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> >> at
> >>
> >>
>
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
> >> at
> >>
> >>
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> >> at
> >>
> >>
>
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:629)
> >> at
> >>
> >>
>
com.adesa.business.rules.RuleHandler$$EnhancerByCGLIB$$3ab6eda.fireUpdatePricing(<generated>)
> >> at
> >>
> >>
>
com.adesa.business.auction.manager.SaleEventManagerImpl.updatePricing(SaleEventManagerImpl.java:2599)
> >> at
> >>
> >>
>
com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfAuction(SaleEventManagerImpl.java:1993)
> >> at
> >>
> >>
>
com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfGroundingSaleEventForHyundai(SaleEventManagerImpl.java:1783)
> >> at
> >>
> >>
>
com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfGroundingSaleEvent(SaleEventManagerImpl.java:1180)
> >> at
> >>
> >>
>
com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfGroundingSaleEvent(SaleEventManagerImpl.java:1134)
> >> at
> >>
> >>
>
com.adesa.business.auction.service.AuctionServiceImpl.cascadeAtEndOfGroundingSaleEvent(AuctionServiceImpl.java:766)
> >> at sun.reflect.GeneratedMethodAccessor263.invoke(Unknown
> Source)
> >> at
> >>
> >>
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >> at java.lang.reflect.Method.invoke(Method.java:618)
> >> at
> >>
> >>
>
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
> >> at
> >>
> >>
>
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
> >> at
> >>
> >>
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
> >> at
> >>
> >>
>
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
> >> at
> >>
> >>
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> >> at
> >>
> >>
>
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77)
> >> at
> >>
> >>
>
com.adesa.business.framework.logging.LoggingInterceptor.profileLog(LoggingInterceptor.java:136)
> >> at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
> >> at
> >>
> >>
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >> at java.lang.reflect.Method.invoke(Method.java:618)
> >> at
> >>
> >>
>
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:597)
> >> at
> >>
> >>
>
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:583)
> >> at
> >>
> >>
>
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:60)
> >> at
> >>
> >>
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> >> at
> >>
> >>
>
org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:50)
> >> at
> >>
> >>
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> >> at
> >>
> >>
>
org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:54)
> >> at
> >>
> >>
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> >> at
> >>
> >>
>
org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
> >> at
> >>
> >>
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> >> at
> >>
> >>
>
org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:54)
> >> at
> >>
> >>
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> >> at
> >>
> >>
>
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
> >> at
> >>
> >>
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> >> at
> >>
> >>
>
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
> >> at $Proxy58.cascadeAtEndOfGroundingSaleEvent(Unknown Source)
> >> at
> >>
> >>
> com.adesa.business.pricing.ejb.PricingBean.updateMBPPrice(PricingBean.java:112)
> >> at
> >>
> >>
>
com.adesa.business.pricing.ejb.EJSRemoteStatelessPricing_a0966b04.updateMBPPrice(EJSRemoteStatelessPricing_a0966b04.java:183)
> >> at
> >>
> >>
>
com.adesa.business.pricing.ejb._EJSRemoteStatelessPricing_a0966b04_Tie.updateMBPPrice(_EJSRemoteStatelessPricing_a0966b04_Tie.java:243)
> >> at
> >>
> >>
>
com.adesa.business.pricing.ejb._EJSRemoteStatelessPricing_a0966b04_Tie._invoke(_EJSRemoteStatelessPricing_a0966b04_Tie.java:108)
> >> at
> >>
> >>
> com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:621)
> >> at
> >> com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:474)
> >> at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
> >> at com.ibm.CORBA.iiop.ORB.process(ORB.java:1571)
> >> at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2701)
> >> at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2575)
> >> at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
> >> at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
> >> at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
> >> Caused by:
> >> java.lang.ClassCastException: com.adesa.data.grounding.pojo.Inventory
> >> incompatible with
> >> com.adesa.data.grounding.pojo.Inventory$$EnhancerByCGLIB$$de81aab3
> >> at ASMAccessorImpl_11448003161226563261710.getValue(Unknown
> >> Source)
> >> at
> >>
> >>
>
org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode.java:22)
> >> at
> >>
> >>
> org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:21)
> >> at
> >>
> >>
> org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21)
> >> at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
> >> at
> >> org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
> >> at org.mvel.MVEL.executeExpression(MVEL.java:235)
> >> at
> >>
> >>
>
org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:45)
> >> at
> >>
> org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:209)
> >> --
> >> View this message in context:
> >>
>
http://www.nabble.com/ClassCastException-when-firing-rules-tp20694738p206...
> >> Sent from the drools - user mailing list archive at
Nabble.com.
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users(a)lists.jboss.org
> >>
https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >
> >
> >
> > --
> > Edson Tirelli
> > JBoss Drools Core Development
> > JBoss, a division of Red Hat @
www.jboss.com
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org
> >
https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/Occasional-ClassCastException-when-firing-rules-tp2...
> Sent from the drools - user mailing list archive at
Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @
www.jboss.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users