By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,200 Members | 1,593 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,200 IT Pros & Developers. It's quick & easy.

Expert Help - class invalid for deserialization.

P: n/a

I am getting an error which I don't understand why.

I have an object Item which I serialize within a servlet and send it across
to an applet but I get this run time error "
com.webacre.servlet.Item; class invalid for deserialization". I tried
changing all compile target to 1.1 but it didn't help. Does anyone know what
The code seem right to me. I am doing wrong? What do I need to do to make
this work?

Thanks for your help.
Mario target Java 1.1)------------
import com.webacre.servlet.Item;
... <stuff deleted> ...

v = new Vector();
ObjectInputStream in = new ObjectInputStream(con.getInputStream());
while ((item = (Item)in.readObject()) != null) {
------------------------------------------------------------------- target Java 1.4)-----------
import com.webacre.servlet.Item;
... <stuff deleted> ...

ObjectOutputStream out = new ObjectOutputStream(res.getOutputStream());
for (int i=0; i < list.size(); i++) {

----------- -----(compile target Java 1.4)----------------
package com.webacre.servlet;

public class Item implements Serializable {

static final long serialVersionUID = 99999999999999L;

private int id = -1;
private double width = 0.0;
private String catalog = "-";

public int getItemId() { return; }
public void setItemId(int i) { = i; }

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.