java.io.NotSerializableException: Publishers
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1362)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1170)
at java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:161)
at java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1687)
at java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:478)
at java.util.Vector.writeObject(Vector.java:1073)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:962)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at Server.run(Server.java:65)
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: Publishers
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1685)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1341)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1964)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1888)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at Client.init(Client.java:49)
at sun.applet.AppletPanel.run(AppletPanel.java:434)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.io.NotSerializableException: Publishers
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1362)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1170)
at java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:161)
at java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1687)
at java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:478)
at java.util.Vector.writeObject(Vector.java:1073)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:962)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at Server.run(Server.java:65)
Are you better than me? Then please show me my mistakes..
Are you better than me? Then please show me my mistakes..
In this case, I assume you just added "implements Serializable" to your definition of Publisher. Did you have to do anything else?
Are you better than me? Then please show me my mistakes..
SCJP
Visit my download page
Randall Twede wrote:this is kind of off the point but i cant help but notice how different that code is from java 2 code. the generics.
i always hated casting
Are you better than me? Then please show me my mistakes..
Greg Charles wrote:Yes, generics have been a nice addition to Java. Actually, another is ArrayList, which is a growable array that implements the java.util.List interface. It's pretty much replaced Vector for this purpose. Vector is synchronized, and performs slowly compared with ArrayList. Most of the time, you're only accessing your lists from a single thread anyway, so synchronizing is a wasted effort.
Greg Charles wrote:You'd have to define what you mean by easier. I don't think Vector is easier that ArrayList, but I haven't used it for something like a decade now. Whoever is forcing you to use Vector is way out of date with the current state of Java. Give me their contact info and I'll yell at them for you.