1
Next, I’m studying a project involving javaWeb, with jsf
+primefaces
. I’m using the apache tomcat 7
. The problem is happening when starting the apache service to then test my application, in which the error I identified was the following:
fev 25, 2016 2:42:56 PM org.apache.catalina.session.StandardSession writeObject
ADVERTÊNCIA: Cannot serialize session attribute contatoController for
session 707B3CF6A468012EFA4220B84449EB6B java.io.NotSerializableException: Bean.ContatoBean
My Contactobean class is as follows:
public class ContatoBean implements Serializable{
private int id;
private String nome;
private String endereco;
private String cidade;
private String uf;
private String telefone;
private String celular;
private String email;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getEndereco() {
return endereco;
}
public void setEndereco(String endereco) {
this.endereco = endereco;
}
public String getCidade() {
return cidade;
}
public void setCidade(String cidade) {
this.cidade = cidade;
}
public String getUf() {
return uf;
}
public void setUf(String uf) {
this.uf = uf;
}
public String getTelefone() {
return telefone;
}
public void setTelefone(String telefone) {
this.telefone = telefone;
}
public String getCelular() {
return celular;
}
public void setCelular(String celular) {
this.celular = celular;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
Even though I’m removing the implements serializable
, he keeps making mistakes, someone knows what could be?
You have a long serialVersionUID declared? or to Annotation @Suppresswarnings("")??
– Thiago Luiz Domacoski
Don’t have Thiago, would you need to put in this class? In case it would be private long serialVersionUID = 1; ???
– Paulo R.-
An example: private Static final long serialVersionUID = -1931519544424229043L;
– Thiago Luiz Domacoski