1

I was trying to serialize an ArrayList which contains custom objects.

I'm serializing it in a Servlet (server side), and deserialize at the client side. (using ObjectOutputStream and ObjectInputStream)

It worked fine, when I work with ArrayList<String>.
But when I tried it with ArrayList<MyObject> I couldn't get any results in the client side, this is the exception:

java.lang.ClassNotFoundException: web.MyObject

Of course I have done this:

public class MyObject implements Serializable { ... }

MyObject contains only String fields.

What have I done wrong?

Thanks,
Ray.

1
  • 1
    Make sure MyObject is in the classpath of your client. Commented May 30, 2010 at 11:08

1 Answer 1

1

The Problem is that your client doesnt know your MyObject when Deserialization. So you have to make sure that this class in also on the classpath.

Edit: oh sry i just saw that Anton was faster

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

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.