无法调用 java.util.concurrent.CopyOnWriteArrayList.readObject() 这个错误是什么意思?

Could not call java.util.concurrent.CopyOnWriteArrayList.readObject() What could This error mean?

一切正常,直到我开始在我的 spring 批处理应用程序中收到此错误,不知道是什么原因或解决方案。任何参考都会有很大帮助。

---- Debugging information ----
message             : Could not call java.util.concurrent.CopyOnWriteArrayList.readObject()
cause-exception     : java.lang.RuntimeException
cause-message       : null
class               : java.util.HashMap
required-type       : java.util.concurrent.CopyOnWriteArrayList
path                : /map/entry/java.util.concurrent.CopyOnWriteArraySet/al/java.util.concurrent.CopyOnWriteArrayList
line number         : -1
-------------------------------
        at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callReadObject(SerializationMethodInvoker.java:88)
        at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doUnmarshal(SerializableConverter.java:386)
        at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:150)
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81)
        at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55)
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75)
        at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:234)
        at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:206)
        at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:150)
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81)
        at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55)
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75)
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59)
        at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:77)
        at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:79)
        at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:66)
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81)
        at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55)
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75)
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59)
        at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:142)
        at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33)
        at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:931)
        at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:917)
        at com.thoughtworks.xstream.XStream.fromXML(XStream.java:861)
        at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)
        at org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer.deserialize(XStreamExecutionContextStringSerializer.java:110)
        at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$ExecutionContextRowMapper.mapRow(JdbcExecutionContextDao.java:322)
        at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$ExecutionContextRowMapper.mapRow(JdbcExecutionContextDao.java:308)
        at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:92)
        at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:60)
        at org.springframework.jdbc.core.JdbcTemplate.doInPreparedStatement(JdbcTemplate.java:649)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:587)
        at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)
        at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666)
        at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674)
        at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:718)
        at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.getExecutionContext(JdbcExecutionContextDao.java:112)
        at org.springframework.batch.core.explore.support.SimpleJobExplorer.getJobExecutionDependencies(SimpleJobExplorer.java:191)
        at org.springframework.batch.core.explore.support.SimpleJobExplorer.getJobExecutions(SimpleJobExplorer.java:80)
        at org.springframework.batch.core.launch.support.SimpleJobOperator.startNextInstance(SimpleJobOperator.java:352)
        at com.ccclogic.bi.utils.JobRegisteringOperator.startNextInstance(JobRegisteringOperator.java:69)
        at com.ccclogic.bi.sync.framework.job.KinesisCDRExtractorJob.call(KinesisCDRExtractorJob.java:36)
        at com.ccclogic.bi.sync.framework.job.KinesisCDRExtractorJob.call(KinesisCDRExtractorJob.java:20)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:96)
        at com.thoughtworks.xstream.io.ReaderWrapper.moveDown(ReaderWrapper.java:36)
        at com.thoughtworks.xstream.io.path.PathTrackingReader.moveDown(PathTrackingReader.java:37)
        at com.thoughtworks.xstream.converters.reflection.SerializableConverter.readFromStream(SerializableConverter.java:275)
        at com.thoughtworks.xstream.core.util.CustomObjectInputStream.readObjectOverride(CustomObjectInputStream.java:86)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:364)
        at java.util.concurrent.CopyOnWriteArrayList.readObject(CopyOnWriteArrayList.java:879)
        at sun.reflect.GeneratedMethodAccessor167.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callReadObject(SerializationMethodInvoker.java:84)
        ... 49 more

您的列表似乎在处理请求时从某处更新。

只有大小不匹配时才会抛出RuntimeException。

以下来自AbstractPullReader.moveDown:

public void moveDown() {
    int currentDepth = elementStack.size();
    while (elementStack.size() <= currentDepth) {
        move();
        if (elementStack.size() < currentDepth) {
            throw new RuntimeException(); // sanity check
        }
    }
}