Transfer existing non-remote object class using Java RMI

I am trying to transfer the Issue class from jira rest client api using Remote Method Invocation (RMI), but the Issue class is not serializable.

Fenced code blocks remain the same.

I am getting the following error when I run the code:

java.rmi.UnmarshalException: error unmarshalling return; 
nested exception is: java.io.WriteAbortedException: writing aborted; 
java.io.NotSerializableException: com.atlassian.jira.rest.client.api.domain.Issue

Does anyone have a solution to allow me to transfer the Issue class between the server and client using RMI?

To allow the Issue class to be transferred using RMI, you need to make it Serializable. However, since you don’t have access to modify the Issue class directly, you can create a wrapper class that implements the Serializable interface and contains an instance of the Issue class.

Here’s an example of how you can create a wrapper class for the Issue class:

import com.atlassian.jira.rest.client.api.domain.Issue;
import java.io.Serializable;

public class SerializableIssue implements Serializable {
    private Issue issue;

    public SerializableIssue(Issue issue) {
        this.issue = issue;
    }

    public Issue getIssue() {
        return issue;
    }
}

Now, instead of directly using the Issue class, you can use the SerializableIssue class to transfer the issue between the server and client using RMI.

Note: Make sure to update your RMI code to use the SerializableIssue class instead of the Issue class.