Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-3949

ClassCastException: IOException cannot be cast to NotSerializableException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.17
    • 1.4.19, 1.5-RC6
    • wicket
    • None

    Description

      I've a page which was throwing NotSerializableException. So I just naively added "implements Serializable", and this is what I get now:

      16:53:26,922 ERROR [lang.Objects] Error serializing object class org.jboss.jawabot.plugin.logger.web._pg.ChannelLogPage [object=[Page class = org.jboss.jawabot.plugin.logger.web._pg.ChannelLogPage, id = 0, version = 0]]
      java.lang.ClassCastException: java.io.IOException cannot be cast to java.io.NotSerializableException
      	at org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:129)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      	at org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1124)
      	at org.apache.wicket.protocol.http.pagestore.AbstractPageStore$PageSerializer.getPageReplacementObject(AbstractPageStore.java:285)
      	at org.apache.wicket.Page.writeReplace(Page.java:1401)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1115)
      	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      	at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1346)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1154)
      	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
      	at org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:121)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      	at org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1124)
      	at org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:203)
      	at org.apache.wicket.protocol.http.pagestore.DiskPageStore.storePage(DiskPageStore.java:840)
      	at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.put(SecondLevelCacheSessionStore.java:332)
      	at org.apache.wicket.Session.requestDetached(Session.java:1435)
      	at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1176)
      	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1462)
      	at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
      	at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
      	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:138)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
      	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      	at org.mortbay.jetty.Server.handle(Server.java:326)
      	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
      	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
      	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      	at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
      	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
      

      Before that, page rendering fails due to a NPE in my code.

      16:53:26,808 ERROR [wicket.RequestCycle] Error attaching this container for rendering: [MarkupContainer [Component id = channelLogPanel]]
      org.apache.wicket.WicketRuntimeException: Error attaching this container for rendering: [MarkupContainer [Component id = channelLogPanel]]
      	at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1769)
      	at org.apache.wicket.Component.onBeforeRender(Component.java:3966)
      	at org.apache.wicket.Component.internalBeforeRender(Component.java:1066)
      	at org.apache.wicket.Component.beforeRender(Component.java:1100)
      	at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1757)
      	at org.apache.wicket.Component.onBeforeRender(Component.java:3966)
      	at org.apache.wicket.Page.onBeforeRender(Page.java:1550)
      	at org.apache.wicket.Component.internalBeforeRender(Component.java:1066)
      	at org.apache.wicket.Component.beforeRender(Component.java:1100)
      	at org.apache.wicket.Component.prepareForRender(Component.java:2292)
      	at org.apache.wicket.Page.prepareForRender(Page.java:1540)
      	at org.apache.wicket.Component.prepareForRender(Component.java:2329)
      	at org.apache.wicket.Page.renderPage(Page.java:911)
      	at org.apache.wicket.protocol.http.WebRequestCycle.redirectTo(WebRequestCycle.java:201)
      	at org.apache.wicket.request.target.coding.HybridUrlCodingStrategy$HybridBookmarkablePageRequestTarget.respond(HybridUrlCodingStrategy.java:983)
      	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
      	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1258)
      	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
      	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
      	at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
      	at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
      	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:138)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
      	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      	at org.mortbay.jetty.Server.handle(Server.java:326)
      	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
      	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
      	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      	at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
      	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
      Caused by: java.lang.NullPointerException
      	at org.jboss.weld.environment.se.jpa.EntityManagerDelegate.createQuery(EntityManagerDelegate.java:125)
      	at org.jboss.jawabot.plugin.logger.bus.ChannelLogManager.getEventsByCriteria(ChannelLogManager.java:36)
      	at org.jboss.jawabot.plugin.logger.bus.org$jboss$weld$bean-classpath-ManagedBean-class_org$jboss$jawabot$plugin$logger$bus$ChannelLogManager_$$_WeldSubclass.getEventsByCriteria(org$jboss$weld$bean-classpath-ManagedBean-class_org$jboss$jawabot$plugin$logger$bus$ChannelLogManager_$$_WeldSubclass.java)
      	at org.jboss.jawabot.plugin.logger.bus.ChannelLogManager.getEventsByCriteria(ChannelLogManager.java:26)
      	at org.jboss.jawabot.plugin.logger.bus.org$jboss$weld$bean-classpath-ManagedBean-class_org$jboss$jawabot$plugin$logger$bus$ChannelLogManager_$$_WeldSubclass.getEventsByCriteria(org$jboss$weld$bean-classpath-ManagedBean-class_org$jboss$jawabot$plugin$logger$bus$ChannelLogManager_$$_WeldSubclass.java)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.jboss.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:114)
      	at org.jboss.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:133)
      	at org.jboss.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:112)
      	at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:65)
      	at org.jboss.jawabot.plugin.logger.bus.org$jboss$weld$bean-classpath-ManagedBean-class_org$jboss$jawabot$plugin$logger$bus$ChannelLogManager_$$_WeldSubclass.getEventsByCriteria(org$jboss$weld$bean-classpath-ManagedBean-class_org$jboss$jawabot$plugin$logger$bus$ChannelLogManager_$$_WeldSubclass.java)
      	at org.jboss.jawabot.plugin.logger.web.IrcEventCriteriaLDM.load(IrcEventCriteriaLDM.java:40)
      	at org.jboss.jawabot.plugin.logger.web.IrcEventCriteriaLDM.load(IrcEventCriteriaLDM.java:19)
      	at org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:120)
      	at org.apache.wicket.Component.getDefaultModelObject(Component.java:1724)
      	at org.apache.wicket.markup.html.list.ListView.getViewSize(ListView.java:220)
      	at org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:511)
      	at org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:131)
      	at org.apache.wicket.Component.internalBeforeRender(Component.java:1066)
      	at org.apache.wicket.Component.beforeRender(Component.java:1100)
      	at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1757)
      	... 36 more
      

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            pekarna Ondra Žižka
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: