[rules-users] Linkage Error In execute method
Karan Malhotra
Karan.Malhotra2 at makemytrip.com
Sat Apr 5 00:16:02 EDT 2014
Hi All,
We have recently upgraded our application from 5.1.0 to 5.4.0.Final.
Everything worked well until this was deployed at Production Envr. We started getting multiple Linkage Error in execute method of Stateless KnowledgeSession.
StackTrace:
Exception: java.util.concurrent.ExecutionException: java.lang.LinkageError: loader (instance oforg/drools/rule/JavaDialectRuntimeData$PackageClassLoader): attemptedduplicate class definition for name: "OffBarCapping/Rule_Off_Bar_Tariff_Capping_13_2a4a909def69414bbd60cdfdac9ad807"|
OffBarCapping/Rule_Off_Bar_Tariff_Capping_16_6b6f1282708449448fc434e820fa8e1f# at OffBarCapping.Rule_Off_Bar_Tariff_Capping_16_6b6f1282708449448fc434e820fa8e1fPredicate0InvokerGenerated.evaluate(Unknown Source)# at OffBarCapping.Rule_Off_Bar_Tariff_Capping_16_6b6f1282708449448fc434e820fa8e1fPredicate0Invoker.evaluate(Unknown Source)# at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:299)# at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)# at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)# at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)# at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)# at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)# at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:337)# at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298)# at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:888)# at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)# at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)# at org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:294)#
1. Some surfing on the internet referred us to a similar JIRA issue:- JBRULES-3675<https://issues.jboss.org/browse/JBRULES-3675>
It says this has been fixed in 6.0.0. We were not in a position to upgrade to 6.0.0 right away and hence decide to apply a patch in drools-core-5.4.0.Final.jar
Drools: 5.4.0
public Class<?> More ...fastFindClass( final String name ) {
Class<?> cls = findLoadedClass( name );
if (cls == null) {
final byte[] clazzBytes = this.store.read( convertClassToResourcePath( name ) );
if (clazzBytes != null) {
String pkgName = name.substring( 0,
name.lastIndexOf( '.' ) );
if (getPackage( pkgName ) == null) {
definePackage( pkgName,
"",
"",
"",
"",
"",
"",
null );
}
cls = defineClass( name,
clazzBytes,
0,
clazzBytes.length,
PROTECTION_DOMAIN );
}
if (cls != null) {
resolveClass( cls );
}
}
return cls;
}
Path applied:-
public Class fastFindClass(String name)
{
Class cls = findLoadedClass(name);
if(cls == null)
{
byte clazzBytes[] = store.read(JavaDialectRuntimeData.convertClassToResourcePath(name));
if(clazzBytes != null)
{
String pkgName = name.substring(0, name.lastIndexOf('.'));
if(!existingPackages.contains(pkgName))
{
synchronized(this)
{
if(!existingPackages.contains(pkgName))
{
if(getPackage(pkgName) == null)
{
definePackage(pkgName, "", "", "", "", "", "", null);
}
existingPackages.add(pkgName);
}
}
}
cls = defineClass(name, clazzBytes, 0, clazzBytes.length, JavaDialectRuntimeData.access$000());
}
if(cls != null)
{
resolveClass(cls);
}
}
return cls;
}
But we are still getting this Error.
Let me know if any one did face a similar issue and solution for the same.
Thanks and regards,
Karan Malhotra
The contents of this email, including the attachments, are PRIVILEGED AND CONFIDENTIAL to the intended recipient at the email address to which it has been addressed. If you receive it in error, please notify the sender immediately by return email and then permanently delete it from your system. The unauthorized use, distribution, copying or alteration of this email, including the attachments, is strictly forbidden. Please note that neither MakeMyTrip nor the sender accepts any responsibility for viruses and it is your responsibility to scan the email and attachments (if any). No contracts may be concluded on behalf of MakeMyTrip by means of email communications.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140405/b93c036b/attachment-0001.html
More information about the rules-users
mailing list