[rules-users] java.lang.LinkageError

David Minor daveminor at gmail.com
Mon Aug 20 16:00:52 EDT 2012


We've managed to determine that the problem only happens *sometimes*
when the rule base is deserialized. Our current theory is that it's a
multithreaded class loading issue, although our synchronization
attempts haven't mitigated it.

We've also seen this variation on the linkage error:

Caused by: java.lang.LinkageError: loader (instance of
org/drools/rule/JavaDialectRuntimeData$PackageClassLoader): attempted
duplicate class definition for name:
"ShoppingCart/Rule_CSPATCHARES5211_CSPATCHARES5211_dd9600d3d08d460caa50fe7c29ee5585"
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
        at org.drools.rule.JavaDialectRuntimeData$PackageClassLoader.fastFindClass(JavaDialectRuntimeData.java:615)
        at org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:254)
        at org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:237)
        at org.drools.util.CompositeClassLoader.loadClass(CompositeClassLoader.java:88)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:410)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at ShoppingCart.Rule_CSPATCHARES5211_CSPATCHARES5211_dd9600d3d08d460caa50fe7c29ee5585Eval0InvokerGenerated.evaluate(Unknown
Source)
        at ShoppingCart.Rule_CSPATCHARES5211_CSPATCHARES5211_dd9600d3d08d460caa50fe7c29ee5585Eval0Invoker.evaluate(Unknown
Source)
        at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:114)
        at org.drools.reteoo.EvalConditionNode.assertLeftTuple(EvalConditionNode.java:178)
...

On Fri, Aug 17, 2012 at 9:37 AM, David Minor <daveminor at gmail.com> wrote:
> The webapps are both running in the same instance of Tomcat.
>
> We're going to try to run a second instance of Tomcat on production
> with the new version to see if we can replicate it.
>
> On Fri, Aug 17, 2012 at 8:33 AM, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:
>> On 17/08/2012, David Minor <daveminor at gmail.com> wrote:
>>> That was the root error, the rest is just drools firing its rules.
>>>
>>> So does this mean there's some sort of incompatibility in the class
>>> ShoppingCart/Rule_CSMEGBUL_b996907c25e3495a94b6b041c1c08c50? I assume
>>> this is a class that's auto-generated by drools. Is it possible that
>>> serializing the rule Package is leading to an incompatible class
>>> definition?
>>
>> It does contain compiled Java code. So if the DRL/Java compilation
>> environment compared to the deployment environment differs w.r.t. to
>> JDK version, you're in for trouble.
>> -W
>>
>>>
>>> On Thu, Aug 16, 2012 at 10:41 PM, Wolfgang Laun <wolfgang.laun at gmail.com>
>>> wrote:
>>>> Javadoc: Subclasses of LinkageError indicate that a class has some
>>>> dependency on another class; however, the latter class has
>>>> incompatibly changed after the compilation of the former class.
>>>>
>>>> Looks like some incompatibility between your development and
>>>> deployment environment.
>>>>
>>>> Did you truncate any helpful message from the stack trace?
>>>>
>>>> -W
>>>>
>>>> On 17/08/2012, David Minor <daveminor at gmail.com> wrote:
>>>>> Hi,
>>>>>
>>>>> We're in the process of moving our web apps from Java 5 to Java 7 and
>>>>> Drools 3 to Drools 5.4.0. Our rule base is compiled and serialized to
>>>>> the db by one app, and read from the db and fired by another.
>>>>>
>>>>> Everything went fine during testing, but when we tried to switch to
>>>>> production we got this when firing the rule base:
>>>>>
>>>>> Caused by: java.lang.LinkageError:
>>>>> ShoppingCart/Rule_CSMEGBUL_b996907c25e3495a94b6b041c1c08c50
>>>>>         at
>>>>> ShoppingCart.Rule_CSMEGBUL_b996907c25e3495a94b6b041c1c08c50Eval0InvokerGenerated.evaluate(Unknown
>>>>> Source)
>>>>>         at
>>>>> ShoppingCart.Rule_CSMEGBUL_b996907c25e3495a94b6b041c1c08c50Eval0Invoker.evaluate(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:114)
>>>>>         at
>>>>> org.drools.reteoo.EvalConditionNode.assertLeftTuple(EvalConditionNode.java:178)
>>>>> [snip]
>>>>>
>>>>> Does anyone have any ideas as to what might cause this?
>>>>>
>>>>> Here is the rule in question if that helps:
>>>>>
>>>>> rule "CSMEGBUL"
>>>>>         salience -1
>>>>>         agenda-group "SubtotalDependent"
>>>>>         when
>>>>>                 delegate: PromotionRuleDelegate ( )
>>>>>                 cart: ShoppingCart ( )
>>>>>                 eval (
>>>>> delegate.checkDateRange("1181718000000","1497337200000") )
>>>>>                 eval ( delegate.checkEnabled("false") )
>>>>>                 eval ( delegate.cartHasPromoCode(cart, "CSMEGBUL") )
>>>>>                 eval ( delegate.checkUsage(1,100027) )
>>>>>         then
>>>>>                 delegate.applyOrderDiscountAmount(cart, 100027, "10.0");
>>>>>                 delegate.promoCodeApplied(cart, "CSMEGBUL");
>>>>> end
>>>>>
>>>>>
>>>>> --
>>>>> _____________
>>>>> David Minor
>>>>> _______________________________________________
>>>>> rules-users mailing list
>>>>> rules-users at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>>
>>> --
>>> _____________
>>> David Minor
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> --
> _____________
> David Minor



-- 
_____________
David Minor


More information about the rules-users mailing list