]
Brian Stansberry reassigned WFLY-14285:
---------------------------------------
Component/s: EJB
Assignee: Cheng Fang (was: Brian Stansberry)
Serialization Errors with EJB over HTTP
---------------------------------------
Key: WFLY-14285
URL:
https://issues.redhat.com/browse/WFLY-14285
Project: WildFly
Issue Type: Bug
Components: EJB
Affects Versions: 21.0.0.Final, 21.0.1.Final, 21.0.2.Final
Reporter: Adriano Teixeira de Souza
Assignee: Cheng Fang
Priority: Major
Attachments: serialization-wf-21-0-2.txt
We are testing our application for upgrade to las version of Wildfly (21.0.2) and on the
ejb client over http in a standalone client application we are facing many serialization
errors that doesn't have on previous versions (20.0.1 and before)
It occurs after 6 times executing a function that call remote ejb. The errors is some
times like this:
{code:java}
Caused by: java.lang.ClassCastException: Cannot cast java.lang.Class to java.util.Date
at java.lang.Class.cast(Class.java:3605)
at
org.jboss.marshalling.reflect.SerializableField.setObject(SerializableField.java:342)
at
org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1864)
at
org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1778)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1406)
...
Caused by: an exception which occurred:
in field
com.my.company.common.entities.PesagemRodoviariaImagem.dataHoraCapturaImagem
{code}
some times like this:
{code:java}
Caused by: java.io.StreamCorruptedException: Unexpected byte found when reading an
object: 224
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:839)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:231)
at
org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1864)
Caused by: an exception which occurred:
in field
com.my.company.common.entities.PesagemRodoviariaImagem.dataHoraCapturaImagem
{code}
and some times like this:
{code:java}
java.io.StreamCorruptedException: ID_CLEAR_CLASS_CACHE token in the middle of stream
processing at
org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:823) at
org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:231)
Caused by: an exception which occurred: in field
com.my.company.common.entities.PesagemRodoviariaImagem.dataHoraCapturaImagem
{code}
A complete stacktrace is attached and the class PesagemRodoviariaImage is like this:
{code:java}
package com.my.company;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
@Entity
public class PesagemRodoviariaImagem extends AbstractEntity{
private static final long serialVersionUID = 4181136886458805429L;
@Id
@SequenceGenerator(allocationSize = 1, name =
"PESAGEMRODOVIARIAIMAGEM_IDPESAGEMRODOVIARIAIMAGEM", sequenceName =
"IDPESAGEMRODOVIARIAIMAGEM")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator =
"PESAGEMRODOVIARIAIMAGEM_IDPESAGEMRODOVIARIAIMAGEM")
private Long idPesagemRodoviariaImagem;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "IDPESO")
private Peso peso;
private String caminho;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "IDCONFIGURACAOFTP")
private ConfiguracaoFTP configuracaoFTP ;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "IDCAMERA")
private Camera camera;
@Temporal(TemporalType.TIMESTAMP)
private Date dataHoraCapturaImagem;
@Transient
private byte[] conteudoArquivo;
... get and sets
{code}
and it super class is
{code:java}
public abstract class AbstractEntity extends AbstractState implements Entity {
private static final long serialVersionUID = 1L;
public AbstractEntity() {
}
public AbstractEntity(EntityState entityState) {
this();
this.setEntityState(entityState);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if(!(obj instanceof AbstractEntity)){
return false;
}
AbstractEntity other = (AbstractEntity) obj;
Long myId = getId();
Long otherId = other.getId();
if (myId == null || otherId == null) {
if(myId == null && otherId == null){
if(this.getClientId() != null && other.getClientId() != null){
return this.getClientId().equals(other.getClientId());
}
}
return false;
}
return myId.longValue() == otherId.longValue();
}
@Override
public int hashCode() {
Long id = getId();
return (id == null) ? super.hashCode() : id.hashCode();
}
@Deprecated
public void validate() throws DCLogicException {
}
@Override
public String toString() {
String description = getClass().getSimpleName() + "[ID:" +
getId()+"]";
if(this instanceof IDescricaoCustomizada){
description +=
"["+((IDescricaoCustomizada)this).getDescricaoCustomizada()+"]";
}
if(this instanceof IDescricaoEntidade){
description +=
"["+((IDescricaoEntidade)this).getDescricaoEntidade()+"]";
}
return description;
}
public boolean hasId() {
return this.getId() != null;
}
}
{code}