编写java客户端与服务器端数据传输的问题。。跪求大神指点
内容有点多,所以选择性上传主要代码见上传的图片,以下内容为通过ObjectInputStream/ObjectOutputStream传输的可以序列化的对象importj...
内容有点多,所以选择性上传主要代码见上传的图片,以下内容为通过ObjectInputStream/ObjectOutputStream传输的可以序列化的对象
import java.io.Serializable;
public class TransferObject <T> implements Serializable{
private static final long serialVersionUID = 1L;
private TransferObjectType type; private T object; public TransferObject(TransferObjectType type){ this.type = type; }
public void setObject(T object){ this.object = object; } public T getObject(){ return object; } public TransferObjectType getType(){ return type; }}
public enum TransferObjectType {
LOGIN, // 用户登录 FILE, // 传输文件
}
public class User implements Serializable { private static final long serialVersionUID = 1L; private String userName; private String userPassword; public void setUserName(String str){ this.userName = str; } public String getUserName(){ return userName; } public void SetUserPassword(String str){ this.userPassword = str; } public String getUserPassword(){ return userPassword; }
}
现在的问题是客户端输入账号密码点击确定后就出现卡死,应该是阻塞的。服务器端抛出异常:java.lang.ClassNotFoundException: com.wish.data.TransferObject(注:后面的包是客户端中的类)
跪求大神指点下,小弟不胜感激。。。 展开
import java.io.Serializable;
public class TransferObject <T> implements Serializable{
private static final long serialVersionUID = 1L;
private TransferObjectType type; private T object; public TransferObject(TransferObjectType type){ this.type = type; }
public void setObject(T object){ this.object = object; } public T getObject(){ return object; } public TransferObjectType getType(){ return type; }}
public enum TransferObjectType {
LOGIN, // 用户登录 FILE, // 传输文件
}
public class User implements Serializable { private static final long serialVersionUID = 1L; private String userName; private String userPassword; public void setUserName(String str){ this.userName = str; } public String getUserName(){ return userName; } public void SetUserPassword(String str){ this.userPassword = str; } public String getUserPassword(){ return userPassword; }
}
现在的问题是客户端输入账号密码点击确定后就出现卡死,应该是阻塞的。服务器端抛出异常:java.lang.ClassNotFoundException: com.wish.data.TransferObject(注:后面的包是客户端中的类)
跪求大神指点下,小弟不胜感激。。。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询