0

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.

  1. Array of LoanDocument

    or

  2. 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();
user207421
  • 305,947
  • 44
  • 307
  • 483
bubai
  • 61
  • 1
  • 5

1 Answers1

0

when we get successful LoanDocument[] in client side, I am not getting any serialVersionUID related exception due to deserialization?

Because you haven't done any changes to that class between deployment to the server and deployment to the client. In the other cases, you had.

user207421
  • 305,947
  • 44
  • 307
  • 483