2017-05-11 31 views
0

一切工作正常,直到我开始在我的春天批处理应用程序中得到这个错误,不知道是什么原因或解决方案。任何参考将有很大的帮助。无法调用java.util.concurrent.CopyOnWriteArrayList.readObject()这个错误是什么意思?

---- 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$1.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$2.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 
+0

是否'CopyOnWriteArayList'有一个方法'readObject'? – bradimus

+1

似乎它与xstream序列化有关。你有没有改变与此相关的事情?例如更新了库,改变了你的对象定义,.. – TmTron

回答

4

看来您的列表在处理请求时从某处更新。

只有在大小不匹配时才会引发RuntimeException。

以下是AbstractPullReader.moveDown:

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

它的方法有什么作用?它何时被调用?是的,所以我在一份工作中创建了线程,可能会造成麻烦。 –

+1

我不是100%确定,但是来自异常堆栈 - 您的类JobRegisteringOperator.startNextInstance从数据库获取一些细节并将其推送到其他线程正在使用的列表中。 – Gaurav

+0

令我惊讶的是,当我放弃'BatchJob'数据库时,问题得到了解决。 :/将永远无法找出真正的原因。 :/ –