1

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

1
  • if my answer doesn't solve the issue, please provide more details about the exception - the whole exception (incl.message and stacktrace), for example ;) Commented Jan 10, 2011 at 14:46

2 Answers 2

3

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)

Sign up to request clarification or add additional context in comments.

2 Comments

And you have to test your classes trying to serialize them (it is, using them trough the RMI service). If your class implements Serializable but it contains a non-Serializable (non-transient) field, kaboom!
just added the Serializable. code follows! hm how do i test the serializable and what are the properties there which i have to take care about . i have no idea. in my eyes everything is seralizable :-)
1

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.