This is a editing of my previous thread.
I have a web application commuting with an applet.
My web application passes an object to an applet using a Thread server such as:
[i]JFreeChart chart;
private ChartOutputServer(){
super();
try {
serverSocket = new ServerSocket();
serverSocket.bind(null);
serverSocket.setSoTimeout(5*60*1000);
}catch (IOException e) {
e.printStackTrace();
}
}
public void run(){
try{
connection = serverSocket.accept();
in = new ObjectInputStream(connection.getInputStream());
String key = (String)in.readObject();
System.out.println("Client Key>" + key);
out = new ObjectOutputStream(connection.getOutputStream());
out.flush();
out.writeObject(chart);
}
}[/i]
On the applet side I receive the object as follow:
[i]try{
requestSocket = new Socket(server, port);
out = new ObjectOutputStream(requestSocket.getOutputStream());
out.flush();
out.writeObject(key);
System.out.println("sent>" + key);
in = new ObjectInputStream(requestSocket.getInputStream());
try{
chart = (JFreeChart)in.readObject();
}
catch(ClassNotFoundException cnfe){
System.err.println("ERROR: data received in unknown format\n" + cnfe);
this.setError("ERROR: data received in unknown format\n");
}
}[/i]
This use to work fine with Glassfish V1 but with Glassfish V2, I keep having an error message on the applet side:
[u][i]Unexpected ERROR: java.io.InvalidClassException: Java.awt.geom.Rectangle2D$Double; class invalid for deserialization.[/i][/u]
I first thought it was a java version problem so I already try to compile the applet with different version: 1.4, 1.5, 1.6. but never get it working.
Can someone help me with that issue??
Thanks
[Message sent by forum member 'smallerw' (smallerw)]
http://forums.java.net/jive/thread.jspa?messageID=346082