问题描述
我已经在 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 stream was reset”时,我看到了这个 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
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)