Clinet runs in JVM A , Server Runs in JVM B. There are all EJB Call from client to server.
Now any of the 2 objects I expect in Client side.
Array of
LoanDocument
or
BusinessServicesException
public interface LoanViewerServicesLocal extends EJBLocalObject { public LoanDocument[] getDocByLoanNumber (String loanNum) throws BusinessServicesException; public interface LoanViewerServices extends EJBObject { public LoanDocument[] getDocByLoanNumber (String loanNum) throws RemoteException,BusinessServicesException;
Now BusinessServicesException
extends CommonException
; CommonException
extends ProjectException
; ProjectException
extends Exception
.
I specified a serialVersionUID
value of 1L
in all my 3 exception class (both client and server side ) to avoid de-serialization issue in Client side.
Otherwise I will get
java.io.InvalidClassException: com.abc.common.ProjectException; local class incompatible: stream classdesc serialVersionUID = 354159461886461208, local class serialVersionUID = -5937350397277039691
Hence mention 1L in all 3 classes (serialVersionUID =1L) resolve the issue.
Now LoanDocument
objects extends CommonDocumentObject
but none of then having serialVersionUID
or implements Serializable
interface.
But when we get successful LoanDocument[]
in client side, I am not getting any serialVersionUID
related exception due to deserialization?
I tested several times, But I always get same serialVersionUID
for LoanDocument
and in CommonDocumentObject.
I use below mention code in Server and Clinet and I get always same serialVersionUID
in both sides.
But always different in case of BusinessServicesException.
Class loanDocClass = LoanDocument.getClass();
long uid = ObjectStreamClass.lookup(loanDocClass).getSerialVersionUID();