Note that there are some explanatory texts on larger screens.

plurals
  1. POClass not found server client Java
    text
    copied!<p>I know that this question has been asked many times but any of the answers help me to get ride of the problem. I am working on a IM program using Java (netbeans)...</p> <p>I have a class called <strong>"message"</strong> in the client side, and I pass the class from client to server, and in the <em>server</em> there is a class called <strong>messege</strong> similar to <strong>messege</strong> class on the <em>client</em> side.</p> <p>I uses ObjectInputStream / ObjectOutputStream to send/receive the Class from/to the server, and the <strong>server</strong> program tell: ClassNotFound exception and point to message class that exist in the <strong>client</strong> side.</p> <p>how to solve this problem. </p> <p><em><strong>points:</em></strong> - the Class Message exist on the two sides, and not missed! - I passes an object not a class - the classes are Serializable - I used casting :</p> <pre><code>msg= (message) SomeObjectInputStream.ReadObject(); </code></pre> <hr> <p>Here is the exact error messages :</p> <blockquote> <p>Oct 05, 2013 4:32:40 PM EIQserver.EIQserver run SEVERE: null</p> </blockquote> <pre><code>java.lang.ClassNotFoundException: RandomSend.Message at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:622) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1593) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1514) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369) at EIQserver.EIQserver.run(EIQserver.java:55) </code></pre> <p>My class:</p> <p>public class Message implements Serializable {...}</p> <p>and the error is pointing here:</p> <pre><code> fromuser=(Message) OIS.readObject(); </code></pre> <p><em><strong>Important: I also Defined the class in the same file of the client class and in the server class (instead of separated files), but still get the same Exception!!!!</em></strong> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload