Dean Turner wrote:
>
> FYI: Spring AOP enhances objects via CGLIB when no interface is available.
> If an interface is avaiable, it uses an jdk dynamic proxy.
>
> -----Original Message-----
> From:
rules-users-bounces@lists.jboss.org
> [mailto:
rules-users-bounces@lists.jboss.org] On Behalf Of seemamani
> Sent: Wednesday, November 26, 2008 11:18 AM
> To:
rules-users@lists.jboss.org
> Subject: Re: [rules-users] ClassCastException when firing rules
>
>
> 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@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(Composi
> teObjectSinkAdapter.java:318)
>>> at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
>>> at
>>>
>>>
> org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(Composi
> teObjectSinkAdapter.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.i
> nit(ManagedStatefulSession.java:87)
>>> at
>>>
>>>
> com.adesa.business.framework.rules.process.drools.ManagedStatefulSession.f
> ireAllRules(ManagedStatefulSession.java:100)
>>> at
>>>
>>>
> com.adesa.business.framework.rules.process.drools.RuleEngineImpl.execute(R
> uleEngineImpl.java:60)
>>> at
>>>
>>>
> com.adesa.business.framework.rules.interceptor.RulesInterceptor.applyAnnot
> edRules(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(DelegatingMethodAccessorIm
> pl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:618)
>>> at
>>>
>>
>>>
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWi
> thGivenArgs(AbstractAspectJAdvice.java:597)
>>> at
>>>
>>>
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(A
> bstractAspectJAdvice.java:583)
>>> at
>>>
>>>
> org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAd
> vice.java:60)
>>> at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>> at
>>>
>>>
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(Exp
> oseInvocationInterceptor.java:89)
>>> at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>> at
>>>
>>>
> org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor
> .intercept(Cglib2AopProxy.java:629)
>>> at
>>>
>>>
> com.adesa.business.rules.RuleHandler$$EnhancerByCGLIB$$3ab6eda.fireUpdateP
> ricing(<generated>)
>>> at
>>>
>>>
> com.adesa.business.auction.manager.SaleEventManagerImpl.updatePricing(Sale
> EventManagerImpl.java:2599)
>>> at
>>>
>>>
> com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfAuct
> ion(SaleEventManagerImpl.java:1993)
>>> at
>>>
>>>
> com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfGrou
> ndingSaleEventForHyundai(SaleEventManagerImpl.java:1783)
>>> at
>>>
>>>
> com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfGrou
> ndingSaleEvent(SaleEventManagerImpl.java:1180)
>>> at
>>>
>>>
> com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfGrou
> ndingSaleEvent(SaleEventManagerImpl.java:1134)
>>> at
>>>
>>>
> com.adesa.business.auction.service.AuctionServiceImpl.cascadeAtEndOfGround
> ingSaleEvent(AuctionServiceImpl.java:766)
>>> at sun.reflect.GeneratedMethodAccessor263.invoke(Unknown Source)
>>> at
>>>
>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> pl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:618)
>>> at
>>>
>>>
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(Ao
> pUtils.java:304)
>>> at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoi
> nt(ReflectiveMethodInvocation.java:182)
>>> at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:149)
>>> at
>>>
>>>
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(
> TransactionInterceptor.java:106)
>>> at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>> at
>>>
>>>
> org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.procee
> d(MethodInvocationProceedingJoinPoint.java:77)
>>> at
>>>
>>>
> com.adesa.business.framework.logging.LoggingInterceptor.profileLog(Logging
> Interceptor.java:136)
>>> at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
>>> at
>>>
>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> pl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:618)
>>> at
>>>
>>>
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWi
> thGivenArgs(AbstractAspectJAdvice.java:597)
>>> at
>>>
>>>
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(A
> bstractAspectJAdvice.java:583)
>>> at
>>>
>>>
> org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAd
> vice.java:60)
>>> at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>> at
>>>
>>>
> org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.
> invoke(AfterReturningAdviceInterceptor.java:50)
>>> at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>> at
>>>
>>>
> org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJA
> fterThrowingAdvice.java:54)
>>> at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>> at
>>>
>>>
>
org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.in
> voke(MethodBeforeAdviceInterceptor.java:50)
>>> at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>> at
>>>
>>>
> org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJA
> fterThrowingAdvice.java:54)
>>> at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>> at
>>>
>>>
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(Exp
> oseInvocationInterceptor.java:89)
>>> at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>> at
>>>
>>>
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopP
> roxy.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.updateMB
> PPrice(EJSRemoteStatelessPricing_a0966b04.java:183)
>>> at
>>>
>>>
> com.adesa.business.pricing.ejb._EJSRemoteStatelessPricing_a0966b04_Tie.upd
> ateMBPPrice(_EJSRemoteStatelessPricing_a0966b04_Tie.java:243)
>>> at
>>>
>>>
> com.adesa.business.pricing.ejb._EJSRemoteStatelessPricing_a0966b04_Tie._in
> voke(_EJSRemoteStatelessPricing_a0966b04_Tie.java:108)
>>> at
>>>
>>>
> com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.jav
> a: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(VariableD
> eepPropertyNode.java:22)
>>> at
>>>
>>>
> org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.ja
> va:21)
>>> at
>>>
>>>
> org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.ja
> va: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(MVELPredicateExpress
> ion.java:45)
>>> at
>>>
> org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:209
> )
>>> --
>>> View this message in context:
>>>
>
http://www.nabble.com/ClassCastException-when-firing-rules-tp20694738p2069
> 4738.html
>>> Sent from the drools - user mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>>
rules-users@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@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-tp20
> 694738p20705144.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
>
rules-users@lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
> _______________________________________________
> rules-users mailing list
>
rules-users@lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--