java.io.NotSerializableException: java.util.RandomAccessSubList

 

16:47:03,522 ERROR [STDERR] java.io.NotSerializableException: java.util.RandomAccessSubList

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)

16:47:03,522 ERROR [STDERR]  at java.util.ArrayList.writeObject(ArrayList.java:570)

16:47:03,522 ERROR [STDERR]  at sun.reflect.GeneratedMethodAccessor392.invoke(Unknown Source)

16:47:03,522 ERROR [STDERR]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

16:47:03,522 ERROR [STDERR]  at java.lang.reflect.Method.invoke(Method.java:597)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)

16:47:03,522 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)

16:47:03,538 ERROR [STDERR]  at java.util.ArrayList.writeObject(ArrayList.java:570)

16:47:03,538 ERROR [STDERR]  at sun.reflect.GeneratedMethodAccessor392.invoke(Unknown Source)

16:47:03,538 ERROR [STDERR]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

16:47:03,538 ERROR [STDERR]  at java.lang.reflect.Method.invoke(Method.java:597)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)

16:47:03,538 ERROR [STDERR]  at java.util.ArrayList.writeObject(ArrayList.java:570)

16:47:03,538 ERROR [STDERR]  at sun.reflect.GeneratedMethodAccessor392.invoke(Unknown Source)

16:47:03,538 ERROR [STDERR]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

16:47:03,538 ERROR [STDERR]  at java.lang.reflect.Method.invoke(Method.java:597)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

16:47:03,538 ERROR [STDERR]  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)

16:47:03,538 ERROR [STDERR]  at org.ajax4jsf.application.AjaxStateHolder.saveState(AjaxStateHolder.java:277)

16:47:03,538 ERROR [STDERR]  at org.ajax4jsf.application.AjaxStateManager.saveStateInSession(AjaxStateManager.java:523)

16:47:03,538 ERROR [STDERR]  at org.ajax4jsf.application.AjaxStateManager.buildViewState(AjaxStateManager.java:503)

16:47:03,538 ERROR [STDERR]  at org.ajax4jsf.application.AjaxStateManager.saveView(AjaxStateManager.java:462)

16:47:03,538 ERROR [STDERR]  at org.apache.myfaces.tomahawk.application.jsp.JspTilesTwoViewHandlerImpl.renderTilesView(JspTilesTwoViewHandlerImpl.java:309)

16:47:03,538 ERROR [STDERR]  at org.apache.myfaces.tomahawk.application.jsp.JspTilesTwoViewHandlerImpl.renderView(JspTilesTwoViewHandlerImpl.java:241)

16:47:03,538 ERROR [STDERR]  at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)

16:47:03,538 ERROR [STDERR]  at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)

16:47:03,538 ERROR [STDERR]  at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)

16:47:03,538 ERROR [STDERR]  at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)

16:47:03,538 ERROR [STDERR]  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

16:47:03,538 ERROR [STDERR]  at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:285)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

16:47:03,538 ERROR [STDERR]  at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)

16:47:03,538 ERROR [STDERR]  at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:295)

16:47:03,538 ERROR [STDERR]  at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:373)

16:47:03,538 ERROR [STDERR]  at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:500)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

16:47:03,538 ERROR [STDERR]  at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:341)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

16:47:03,538 ERROR [STDERR]  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

16:47:03,538 ERROR [STDERR]  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

16:47:03,538 ERROR [STDERR]  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

16:47:03,538 ERROR [STDERR]  at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

16:47:03,538 ERROR [STDERR]  at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

16:47:03,538 ERROR [STDERR]  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

16:47:03,538 ERROR [STDERR]  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

16:47:03,538 ERROR [STDERR]  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

16:47:03,538 ERROR [STDERR]  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)

16:47:03,538 ERROR [STDERR]  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

16:47:03,538 ERROR [STDERR]  at java.lang.Thread.run(Thread.java:619)


说是RandomAccessSubList没有序列化,网上没找到解决方法。



8个回答

[quote]java.util.List接口中方法:
List subList(int fromIndex,int toIndex)
参数:fromIndex - subList 的低端(包括)toIndex - subList 的高端(不包括)
此接口返回的是原List的部分元素视图,返回视图的elementData会包含原List所有元素数据。
元素类型是java.util.RandomAccessSubList,此类型没有实现序列化接口,Rmi直接传输此视图将报错:
java.rmi.MarshalException: error marshalling return; nested exception is:
java.io.NotSerializableException: java.util.RandomAccessSubList。
转换到ArrayList就可以序列化远程传输:ArrayList.addAll(list.subList());[/quote]

还有,你的对像需要实现序列化接口
就是像这样的
public class test1 implements Serializable

loujianwen123
loujianwen123 太感谢了,终于知道原因了
接近 7 年之前 回复

RandomAccessSubList这个是什么东西?

应该是其他地方有问题,这个是jdk内部的一个类。

你代码里面是不是使用了[code="java"]list.subList()[/code]方法?

把前后台的代码贴出来看看。

:o :o :o :o ,代码好长

EclaimMiscellaneousTO你这个对像的类代码看看

或者你这个类实现 implements Serializable 接口了吗,没 有的话加上试试

异常出现在ManagedBean方法调用过程中,还是该方法已经执行完成?

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐