执行RPC GWT时出现SerializationPolicy错误

时间:2014-03-25 22:05:15

标签: gwt rpc

在我的Google Web Toolkit项目中,我收到以下错误:

类型'com.example.model.User _ $$ _ javassist_1'未包含在可由此SerializationPolicy序列化的类型集中,或者无法加载其Class对象。出于安全考虑,此类型不会被序列化:instance = com.example.model.User@1dc2baa

出现此错误的可能原因是什么?

package com.example.model;

import java.io.Serializable;

public class User implements Serializable {

  private Integer id;
  private String username;
  private String fullname;
  private String firstname;
  private String lastname;
  private String password;
  private String picture;
  private String adresse;
  private String email;
  private Integer telephone;
  private Integer fax;
  private String role;

  public User() {

  }

  public User(Integer id, String username, String fullname, String firstname,
          String lastname, String password, String picture, String adresse,
          String email, Integer telephone, Integer fax, String role) {
      this.id = id;
      this.username = username;
      this.fullname = fullname;
      this.firstname = firstname;
      this.lastname = lastname;
      this.password = password;
      this.picture = picture;
      this.adresse = adresse;
      this.email = email;
      this.telephone = telephone;
      this.fax = fax;
      this.role = role;
  }

  public Integer getId() {
      return id;
  }

  public void setId(Integer id) {
      this.id = id;
  }

  public String getUsername() {
      return username;
  }

  public void setUsername(String username) {
      this.username = username;
  }

  public String getFullname() {
      return fullname;
  }

  public void setFullname(String fullname) {
      this.fullname = fullname;
  }

  public String getFirstname() {
      return firstname;
  }

  public void setFirstname(String firstname) {
      this.firstname = firstname;
  }

  public String getLastname() {
      return lastname;
  }

  public void setLastname(String lastname) {
      this.lastname = lastname;
  }

  public String getPassword() {
      return password;
  }

  public void setPassword(String password) {
      this.password = password;
  }

  public String getPicture() {
      return picture;
  }

  public void setPicture(String picture) {
      this.picture = picture;
  }

  public String getAdresse() {
      return adresse;
  }

  public void setAdresse(String adresse) {
      this.adresse = adresse;
  }

  public String getEmail() {
      return email;
  }

  public void setEmail(String email) {
      this.email = email;
  }

  public Integer getTelephone() {
      return telephone;
  }

  public void setTelephone(Integer telephone) {
      this.telephone = telephone;
  }

  public Integer getFax() {
      return fax;
  }

  public void setFax(Integer fax) {
      this.fax = fax;
  }

  public String getRole() {
      return role;
  }

  public void setRole(String role) {
      this.role = role;
  }

}
package com.example.model;

import java.io.Serializable;
import java.util.Date;

public class Projet implements Serializable {

    private Integer id;
    private User user;
    private String name;
    private String description;
    private String abrevation;
    private Date dateDebut;
    private Date dateFin;
    private Date realDateDeb;
    private Date realDateFin;
    private String icone;
    private Double budget;
    private Double tauxTva;

    public Projet() {

    }

    public Projet(Integer id, User user, 
            String name, String description,
            String abrevation, Date dateDebut, Date dateFin, Date realDateDeb,
            Date realDateFin, String icone, Double budget, Double tauxTva) {
        this.id = id;
        this.user = user;
        this.name = name;
        this.description = description;
        this.abrevation = abrevation;
        this.dateDebut = dateDebut;
        this.dateFin = dateFin;
        this.realDateDeb = realDateDeb;
        this.realDateFin = realDateFin;
        this.icone = icone;
        this.budget = budget;
        this.tauxTva = tauxTva;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getAbrevation() {
        return abrevation;
    }

    public void setAbrevation(String abrevation) {
        this.abrevation = abrevation;
    }

    public Date getDateDebut() {
        return dateDebut;
    }

    public void setDateDebut(Date dateDebut) {
        this.dateDebut = dateDebut;
    }

    public Date getDateFin() {
        return dateFin;
    }

    public void setDateFin(Date dateFin) {
        this.dateFin = dateFin;
    }

    public Date getRealDateDeb() {
        return realDateDeb;
    }

    public void setRealDateDeb(Date realDateDeb) {
        this.realDateDeb = realDateDeb;
    }

    public Date getRealDateFin() {
        return realDateFin;
    }

    public void setRealDateFin(Date realDateFin) {
        this.realDateFin = realDateFin;
    }

    public String getIcone() {
        return icone;
    }

    public void setIcone(String icone) {
        this.icone = icone;
    }

    public Double getBudget() {
        return budget;
    }

    public void setBudget(Double budget) {
        this.budget = budget;
    }

    public Double getTauxTva() {
        return tauxTva;
    }

    public void setTauxTva(Double tauxTva) {
        this.tauxTva = tauxTva;
    }

}
  

      

<hibernate-mapping>

    <class name="com.example.model.Projet" table="PROJET" lazy="true">
        <id name="id" column="PROJET_ID">
            <generator class="native"/>
        </id>
        <property name="name"/>
        <property name="description"/>
        <property name="abrevation"/>
        <property name="dateDebut"/>
        <property name="dateFin"/>
        <property name="realDateDeb"/>
        <property name="realDateFin"/>
        <property name="icone"/>
        <property name="budget"/>
        <property name="tauxTva"/>
        <!-- 

         -->
         <many-to-one name="user" class="com.example.model.User" fetch="select">
            <column name="USER_ID" not-null="true" />
        </many-to-one>

    </class>

</hibernate-mapping>
     

      

<hibernate-mapping>

    <class name="com.example.model.User" table="USER" lazy="true">
        <id name="id" column="USER_ID">
            <generator class="native"/>
        </id>
        <property name="username"/>
        <property name="fullname"/>
        <property name="firstname"/>
        <property name="lastname"/>
        <property name="password"/>
        <property name="picture"/>
        <property name="adresse"/>
        <property name="email"/>
        <property name="telephone"/>
        <property name="fax"/>
        <property name="role"/>
    </class>

</hibernate-mapping>

0 个答案:

没有答案