EclipseGWTJavaTomcat-上载到托管服务器时出现序列化策略问题
我使用Eclipse(4.3.2)和GWT对我的应用程序进行了更改,并在它工作的本地Tomcat上进行了测试。但是,当我将其上传到托管服务器时(我进行了完整上传,而不仅仅是我更改的类),当我尝试使用它(登录)时,日志中会出现以下错误: 我所做的改变是: AccountUpdateView.java,其中我添加了一个标签和一个文本框来显示“组”(客户端) AccountAndCubs.java,我在其中添加了要在AccountUpdateView.java(客户端)中显示的新字段(get和set) 在MySQLConnection.java中,我向sql调用添加了新字段(服务器端) 在我的搜索中,我发现了一些与此相关的信息,建议我将“static final long serialVersionUID=1L;”添加到我更改的类(AccountUpdateView.java)中,但是我仍然得到了这个错误 我注意到这句话:EclipseGWTJavaTomcat-上载到托管服务器时出现序列化策略问题,java,eclipse,tomcat,gwt,Java,Eclipse,Tomcat,Gwt,我使用Eclipse(4.3.2)和GWT对我的应用程序进行了更改,并在它工作的本地Tomcat上进行了测试。但是,当我将其上传到托管服务器时(我进行了完整上传,而不仅仅是我更改的类),当我尝试使用它(登录)时,日志中会出现以下错误: 我所做的改变是: AccountUpdateView.java,其中我添加了一个标签和一个文本框来显示“组”(客户端) AccountAndCubs.java,我在其中添加了要在AccountUpdateView.java(客户端)中显示的新字段(get和set)
SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'org.AwardTracker.client.ViewData' was not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field serializer.For security purposes, this type will not be serialized.: instance = org.AwardTracker.client.ViewData@62066d5c
这表明“ViewData.java”存在问题,我没有更改,并且已经有:
package org.AwardTracker.client;
import java.io.Serializable;
public class ViewData implements Serializable {
private static final long serialVersionUID = 1L;
非常感谢您的帮助。此外,我不是很专业,仍在学习,所以请耐心等待我,并使用简单的语言
按要求增加: ViewData代码:
package org.AwardTracker.client;
import java.io.Serializable;
public class ViewData implements Serializable {
private static final long serialVersionUID = 1L;
private String accountId;
private String accountLevel;
private String ymId;
private String awId;
private String adAwardGroup;
private String adScoutGroup;
public ViewData() {
//just here because GWT wants it.
}
public String getaccountId() {
return accountId;
}
public void setaccountId(String accountId) {
this.accountId = accountId;
}
public String getaccountLevel() {
return accountLevel;
}
public void setaccountLevel(String accountLevel) {
this.accountLevel = accountLevel;
}
public String getymId() {
return ymId;
}
public void setymId(String ymId) {
this.ymId = ymId;
}
public String getawId() {
return awId;
}
public void setawId(String awId) {
this.awId = awId;
}
public String getadAwardGroup() {
return adAwardGroup;
}
public void setadAwardGroup(String adAwardGroup) {
this.adAwardGroup = adAwardGroup;
}
public String getadScoutGroup() {
return adScoutGroup;
}
public void setadScoutGroup(String adScoutGroup) {
this.adScoutGroup = adScoutGroup;
}
}
AccountsAndCubs.java代码(“已添加组”):
@伊戈尔利默,@ChrisHinshaw谢谢你的帮助 经过一段时间的尝试和错误,我终于让这项工作开始了。以防您想知道(这将在将来帮助您)我:
Glyn但是,我还没有找到实际的修复方法(无法尝试您的,因为无法在测试环境中删除ROOT.war),我找到了一些可能对其他人有用的解决方法 上述问题的主要问题是: 找不到序列化策略文件“/org.AwardTracker.AwardTracker/C7227FD579DD02DA4BB5B3EBAD09AE79.gwt.rpc”;您是否忘记将其包含在此部署中 通常情况下,这是因为部署的WAR文件包含应用程序文件夹,其中有一个rpc文件。但是,由于tomcat缓存或任何其他问题,它仍在查找以前部署中使用的旧rpc文件 所以解决的办法是,备份上一个文件并再次复制到应用程序文件夹
这看起来是正确的,您可能需要清理、构建和重新部署。您好@ChrisHinshaw,在Eclipse中,我已经进行了刷新、清理,然后进行了GWT编译。有什么原因使它在我的Tomcat上工作而不是在主机Tomcat上工作,或者这不是不寻常的吗?您确定ViewData仍然可以按照顺序进行序列化吗?它没有改变,但可能它的一个字段改变了,并且不再可序列化?你说“完全上传”是什么意思?您是否也更新了RPC序列化清单(*.gwt.RPC文件)?还有GWT编译器产生的所有排列?嗨@IgorKlimer,对不起,我不明白。如果我没有更改ViewData.java,它的一个字段怎么会更改?我通过复制war完成了完整的上传,删除了/WEB-INF/lib/gwt-dev.jar,压缩了内容,将压缩后的文件重命名为ROOT.war,然后上传。上传后,我重新启动了Tomcat服务。我将尝试上传只是改变了的类,但是,如果这样做,这将不会帮助我在未来,如果我需要做一个完整的上传。您好,GlynYou提到您更改了
AccountCubAssociation
-如果它是ViewData
中的一个字段,并且由于更改AccountCubAssociation
不再可序列化,则ViewData
也将不可序列化。请发布整个代码-ViewData
,accountcubsociation
。但我敢打赌,您的手动部署是问题的根源——您是否尝试过像Ant、Maven或Gradle这样的构建工具?从长远来看,这是值得努力的。
package org.AwardTracker.client;
import java.io.Serializable;
public class ViewData implements Serializable {
private static final long serialVersionUID = 1L;
private String accountId;
private String accountLevel;
private String ymId;
private String awId;
private String adAwardGroup;
private String adScoutGroup;
public ViewData() {
//just here because GWT wants it.
}
public String getaccountId() {
return accountId;
}
public void setaccountId(String accountId) {
this.accountId = accountId;
}
public String getaccountLevel() {
return accountLevel;
}
public void setaccountLevel(String accountLevel) {
this.accountLevel = accountLevel;
}
public String getymId() {
return ymId;
}
public void setymId(String ymId) {
this.ymId = ymId;
}
public String getawId() {
return awId;
}
public void setawId(String awId) {
this.awId = awId;
}
public String getadAwardGroup() {
return adAwardGroup;
}
public void setadAwardGroup(String adAwardGroup) {
this.adAwardGroup = adAwardGroup;
}
public String getadScoutGroup() {
return adScoutGroup;
}
public void setadScoutGroup(String adScoutGroup) {
this.adScoutGroup = adScoutGroup;
}
}
package org.AwardTracker.client;
import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.Date;
public class AccountAndCubs implements IsSerializable {
static final long serialVersionUID = 1L;
//@SuppressWarnings("unused")
private String accountId;
//@SuppressWarnings("unused")
private String emailaddress;
//@SuppressWarnings("unused")
private String password;
//@SuppressWarnings("unused")
private String level;
//@SuppressWarnings("unused")
private String pack;
//@SuppressWarnings("unused")
private Integer enabled;
//@SuppressWarnings("unused")
private Date archived;
//@SuppressWarnings("unused")
private String group;
//@SuppressWarnings("unused")
private String acaId;
//@SuppressWarnings("unused")
private String cdId;
//@SuppressWarnings("unused")
private String surname;
//@SuppressWarnings("unused")
private String firstname;
@SuppressWarnings("unused")
private AccountAndCubs() {
//just here because GWT wants it.
}
public AccountAndCubs(String accountId, String emailaddress, String password, String level, String pack,
Integer enabled, Date archived, String group, String acaId, String cdId, String surname, String firstname) {
this.accountId = accountId;
this.emailaddress = emailaddress;
this.password = password;
this.level = level;
this.pack = pack;
this.enabled = enabled;
this.archived = archived;
this.group = group;
this.acaId = acaId;
this.cdId = cdId;
this.surname = surname;
this.firstname = firstname;
}
public String getAccountId() {
return accountId;
}
public void setAccountId(String accountId) {
this.accountId = accountId;
}
public String getEmailAddress() {
return emailaddress;
}
public void setEmailAddress(String emailaddress) {
this.emailaddress = emailaddress;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getPack() {
return pack;
}
public void setPack(String pack) {
this.pack = pack;
}
public Integer getEnabled() {
return enabled;
}
public void setEnabled(Integer enabled) {
this.enabled = enabled;
}
public Date getArchived() {
return archived;
}
public void setArchived(Date archived) {
this.archived = archived;
}
public String getGroup() {
return group;
}
public void setGroup(String group) {
this.group = group;
}
public String getAcaId() {
return acaId;
}
public void setAcaId(String acaId) {
this.acaId = acaId;
}
public String getCdId() {
return cdId;
}
public void setCdId(String cdId) {
this.cdId = cdId;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getFirstName() {
return firstname;
}
public void setFirstName(String firstname) {
this.firstname = firstname;
}
}