EJB клиента Wildfly через HTTP с ошибками RiverUnmarshaller и поток Http2 был сброшен
Я протестировал наше приложение на Wildfly 21.0.2, и у нас есть некоторые ошибки примерно 5 раз при выполнении, и я не могу представить, что это не ошибка клиентских библиотек Wildfly.
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
или же
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
Или же
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
Я также тестировал версии между 15.0.1 и 20.0.1 и выполнял около 16 раз, я всегда сталкивался с этими ошибками.
java.io.IOException: UT000103: Http2 stream was reset
at io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener.handleEvent(Http2ClientConnection.java:446)
at io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener.handleEvent(Http2ClientConnection.java:387)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:952)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:932)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
Я думаю, что это может быть что-то о любой проблеме с буферной памятью, но я не знаю, чтобы сказать наверняка. С другой стороны, у нашего программного обеспечения есть функция использования данных о весе, это последнее исключение всегда возникает при первом запуске.
Класс сущности PesagemRodoviariaImagem имеет этот код
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
и это супер класс
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;
}
}
Когда я получил «java.io.IOException: UT000103: поток Http2 был сброшен» на сервере, я увидел этот stackeTrace
11:08:53,212 ERROR [org.wildfly.httpclient.common] (default task-304) WFHTTP000006: Failed to write exception: java.nio.channels.ClosedChannelException
at io.undertow.core@2.2.2.Final//io.undertow.channels.DetachableStreamSinkChannel.write(DetachableStreamSinkChannel.java:238)
at io.undertow.core@2.2.2.Final//io.undertow.server.HttpServerExchange$WriteDispatchChannel.write(HttpServerExchange.java:2181)
at io.undertow.core@2.2.2.Final//io.undertow.io.UndertowOutputStream.writeBufferBlocking(UndertowOutputStream.java:296)
at io.undertow.core@2.2.2.Final//io.undertow.io.UndertowOutputStream.flush(UndertowOutputStream.java:278)
at java.base/java.io.FilterOutputStream.flush(FilterOutputStream.java:153)
at org.jboss.marshalling@2.0.9.Final//org.jboss.marshalling.SimpleDataOutput.flush(SimpleDataOutput.java:339)
at org.jboss.marshalling@2.0.9.Final//org.jboss.marshalling.SimpleDataOutput.write(SimpleDataOutput.java:85)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:119)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1141)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1099)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:266)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.writeArrayObject(RiverMarshaller.java:310)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:220)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1141)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverObjectOutputStream.defaultWriteObject(RiverObjectOutputStream.java:165)
at java.base/java.lang.Throwable.writeObject(Throwable.java:996)
at org.jboss.marshalling@2.0.9.Final//org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:89)
at org.jboss.marshalling@2.0.9.Final//org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:193)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1087)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1078)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1078)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1078)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:266)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1141)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverObjectOutputStream.defaultWriteObject(RiverObjectOutputStream.java:165)
at java.base/java.lang.Throwable.writeObject(Throwable.java:996)
at org.jboss.marshalling@2.0.9.Final//org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:89)
at org.jboss.marshalling@2.0.9.Final//org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:193)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1087)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1078)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1078)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1078)
at org.jboss.marshalling.river@2.0.9.Final//org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:266)
at org.jboss.marshalling@2.0.9.Final//org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
at org.jboss.marshalling@2.0.9.Final//org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
at org.wildfly.http-client.common@1.1.2.Final//org.wildfly.httpclient.common.HttpServerHelper.sendException(HttpServerHelper.java:54)
at org.wildfly.http-client.ejb@1.1.2.Final//org.wildfly.httpclient.ejb.HttpInvocationHandler$1.writeException(HttpInvocationHandler.java:270)
at org.jboss.as.ejb3@21.0.2.Final//org.jboss.as.ejb3.remote.AssociationImpl.receiveInvocationRequest(AssociationImpl.java:150)
at org.wildfly.http-client.ejb@1.1.2.Final//org.wildfly.httpclient.ejb.HttpInvocationHandler.lambda$handleInternal$0(HttpInvocationHandler.java:135)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at org.jboss.xnio@3.8.2.Final//org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1280)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: an exception which occurred:
in field java.lang.StackTraceElement.methodName
in object java.lang.StackTraceElement@3aee1b23
in field java.lang.Throwable.stackTrace
in object java.io.EOFException@20dff50f
in field java.lang.Throwable.cause
in object javax.ejb.EJBException@5ca83d97
in object javax.ejb.EJBException@5ca83d97