-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
21.0.0.Final, 21.0.1.Final, 21.0.2.Final
-
None
-
Undefined
-
---
-
---
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:
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
some times like this:
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
A complete stacktrace is attached
The class Peso is like this
package com.my.company; import java.math.BigDecimal; import java.util.Date; import java.util.Set; import javax.persistence.Column; 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.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Temporal; import javax.persistence.TemporalType; @Entity public class Peso extends AbstractEntity{ private static final long serialVersionUID = 1L; @Id @SequenceGenerator(allocationSize = 1, name = "PESO_IDPESO", sequenceName = "IDPESO") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PESO_IDPESO") private Long idPeso; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "IDBALANCA") private Balanca balanca; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "IDFLAGTIPOCAPTURAPESO") private Flag flagTipoCapturaPeso; @Column(precision=15, scale=5) private BigDecimal peso; @Temporal(TemporalType.TIMESTAMP) private Date dataHoraCapturaPeso; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "IDUSUARIO") private Usuario usuario; @Column(length=255) private String justificativaPesagemManual; @OneToMany(mappedBy = "peso", fetch = FetchType.LAZY) private Set<PesagemRodoviariaImagem> pesagemRodoviariaImagens; get and set ... }
The class PesagemRodoviariaImage is like this:
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
and it super class is
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; } }