Thursday, May 18, 2023

How to deal with Java.rmi.MarshalException: CORBA MARSHAL in Java? Solution

Java has some mysterious RMI exceptions one of them is java.rmi.MarshalException: CORBA MARSHAL, which was bothering me for the last couple of days while working. I thought to put this solution post similar to my earlier post How to solve OutofMEmoryError in Java and Fixing ClassNotFoundException in Java. RMI is still used in many places and many times it creates too many problems and chew-up your a lot of time to find the exact cause and solution.

What is Marshal Exception in Java

Recently I am working on one project and there we are using java RMI there we are getting marshalException which inspire me to write the solution as one article. Let start with
What is marshalException in Java?

Marshal Exception occurs during the remote method call known as RMI when marshaling is not done and argument or the return value will not reach to remote method or we can say to the server.
One another reason for occurring this Exception if the protocol we are using in RMI is a different version on the sender and receiver side

Signature: public class MarshalException extends RemoteException

Java.rmi.MarshalException: CORBA MARSHAL Example



java.rmi.MarshalException: CORBA MARSHAL 0 No; nested exception is:
org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge:
Mismatched serialization UIDs

Solution: we can use the following solution to solve the problem

java.rmi.MarshalException: CORBA MARSHAL SolutionThis is a known problem and results from the way that Java generates the serialized version UID for EJB classes. 

This problem can be corrected by modifying the last 3 or 4 digits of the serialVersionUID that was generated for the bean and primary key classes. Change the last 3 or 4 digits to some unique value, generate the deployed code, and export the jar file and restart the server.


Related Java Tutorial


No comments:

Post a Comment