简体   繁体   中英

How can I avoid the MarshalException for Java RMI?

I just finished a small program with java rmi and somehow it doesn't work. Everytime I want to start the server I'm getting the MarshalException. Are there any important points that I should be aware of them on how to implement the interface for the remote method invocation? I thought it would be possible to create an implementation but also include some additional methods like a constructor or private variables inside of the implementing class.

Shouldn't this just work?

Greetings

In order to be able to transfer objects you need to make them implement Serializable . And perhaps have a default (no-arg) constructor (this is not a requirement for serialization though)

As helios noted, not only the class, but all your field hierarchy (classes of fields, and the classes of their fields) must be Serializable )

Caused by: java.lang.ClassNotFoundException: vsys.ue04.server.RemoteChargeImplementation

There's your problem. That class is required at the client.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM