views:

113

answers:

1

Hi, 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  A: 

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

Roflcoptr