Bug 724374 (BRMS-320)

Summary: Creating packages with Guvnor 5.1
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Mohamed BEN AYED <mohamed.ensi>
Component: BRM (Guvnor)Assignee: Default User <jbpapp-maint>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: high    
Version: 5.1.0 GACC: esteban.aliverti
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/BRMS-320
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Drools 5.1 SNAPSHOT
Last Closed: 2010-06-08 15:36:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Mohamed BEN AYED 2010-05-28 07:11:20 UTC
Date of First Response: 2010-05-29 11:09:12
securitylevel_name: Public

when I want to access to a PKG file depployed with Guvnor from a KnowledgeAgent, I get this exception:

java.lang.RuntimeException: KnowledgeAgent exception while trying to deserialize KnowledgeDefinitionsPackage   
        at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:586) 
        at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:541) 
        at org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:731) 
        at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:515) 
        at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:145) 
        at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:130) 
        at com.cylande.MainKAgent.main(MainKAgent.java:171) 
Caused by: java.io.InvalidClassException: org.drools.rule.DialectRuntimeRegistry; local class incompatible: stream classdesc serialVersionUID = 5308493362083281112, local class serialVersionUID = 2297533903900118816 
        at java.io.ObjectStreamClass.initNonProxy(Unknown Source) 
        at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source) 
        at java.io.ObjectInputStream.readClassDesc(Unknown Source) 
        at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) 
        at java.io.ObjectInputStream.readObject0(Unknown Source) 
        at java.io.ObjectInputStream.readObject(Unknown Source) 
        at org.drools.rule.Package.readExternal(Package.java:198) 
        at java.io.ObjectInputStream.readExternalData(Unknown Source) 
        at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) 
        at java.io.ObjectInputStream.readObject0(Unknown Source) 
        at java.io.ObjectInputStream.readObject(Unknown Source) 
        at org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:189) 
        at org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:158) 
        at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:575) 
        ... 6 more

Comment 1 Esteban Aliverti 2010-05-29 15:09:12 UTC
I have the exact same issue when adding a pkg file created by guvnor into kbuilder. So Knowledge Agent has nothing to do here. 
KAgent is failing in the following lines:
                is = resource.getInputStream();
                Object object = DroolsStreamUtils.streamIn(is);

Comment 2 Anatoly Polinsky 2010-05-29 18:42:46 UTC
I do not have an access to the source code right now, but does "DialectRuntimeRegistry" have a "private static final long serialVersionUID" defined?

The error you are experiencing usually happens when the Java class compiled by the client is different (have a different serialVersionUID) from the same Java class compiled by the server. You have two options:

1. To define "private static final long serialVersionUID" with a constant number in that Java class, this way the client and the server compiled class will be identical

2. Compile both, the client and the server Java class on the server, and copy the .class to the client ( dirty option )

/Anatoly 

Comment 3 Esteban Aliverti 2010-05-29 18:57:32 UTC
org.drools.rule.DialectRuntimeRegistry doesn't define serialVersionUID. 
The error seems to be fixed after declare serialVersionUID field. I'm running a full build to make sure this fix doesn't break any test.