1 Reply Latest reply on Aug 4, 2010 12:52 PM by Pete Muir

    PWC2785: Cannot serialize session

    Kyle Renfro Newbie

      GlassFish 3.0.1 (build 22)


      When I shutdown server with active session, I get trace below.  On server startup, I also get a severe error PWC2768: IOException while loading persisted sessions: java.io.OptionalDataException.  Obviously, my sessions are not persisting across restarts.  Not too worried about this, but want to be able to eventually operate in a clustered environment (glassfish 3.1) and I suppose the session information will need to be moved around.  It seems pretty bad that the server cannot persist my session.


      I have looked at everything I can think of trying to ensure that all of my beans are serializable. I am using EJB3 and CDI. 


      Note: I was getting a similar stack trace with information about which classes were not being serialized.  I was able to fix the problem classes and the exceptions have dwindled to this:


      Question 1: Is this really a problem?


      Question 2: Any ideas on what I can do to fix this?


      INFO: PWC2785: Cannot serialize session attribute org.jboss.weld.context.SessionContext#org.jboss.weld.bean-weld-ManagedBean-class org.jboss.weld.conversation.ServletConversationManager for session 4f2cabd25c45b0f3cf75d2d7fb80
      java.io.NotSerializableException: org.jboss.weld.conversation.ConversationEntry
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
              at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
              at java.util.concurrent.ConcurrentHashMap.writeObject(ConcurrentHashMap.java:1247)
              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.invokeWriteObject(ObjectStreamClass.java:945)
              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
              at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
              at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
              at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
              at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1935)
              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.invokeWriteObject(ObjectStreamClass.java:945)
              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
              at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
              at org.apache.catalina.session.StandardManager.writeSessions(StandardManager.java:719)
              at org.apache.catalina.session.StandardManager.doUnloadToFile(StandardManager.java:637)
              at org.apache.catalina.session.StandardManager.unload(StandardManager.java:608)
              at org.apache.catalina.session.StandardManager.stop(StandardManager.java:899)
              at org.apache.catalina.core.StandardContext.stop(StandardContext.java:5456)
              at com.sun.enterprise.web.WebModule.stop(WebModule.java:530)
              at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1057)
              at com.sun.enterprise.web.WebContainer.unloadWebModule(WebContainer.java:2158)
              at com.sun.enterprise.web.WebContainer.unloadWebModule(WebContainer.java:2106)
              at com.sun.enterprise.web.WebApplication.stop(WebApplication.java:133)
              at org.glassfish.internal.data.EngineRef.stop(EngineRef.java:165)
              at org.glassfish.internal.data.ModuleInfo.stop(ModuleInfo.java:268)
              at org.glassfish.internal.data.ApplicationInfo.stop(ApplicationInfo.java:251)
              at com.sun.enterprise.v3.server.ApplicationLoaderService.preDestroy(ApplicationLoaderService.java:414)
              at com.sun.hk2.component.AbstractWombInhabitantImpl.dispose(AbstractWombInhabitantImpl.java:74)
              at com.sun.hk2.component.SingletonInhabitant.release(SingletonInhabitant.java:66)
              at com.sun.hk2.component.LazyInhabitant.release(LazyInhabitant.java:112)
              at com.sun.enterprise.v3.server.AppServerStartup.stop(AppServerStartup.java:393)
              at org.jvnet.hk2.osgiadapter.HK2Main.stop(HK2Main.java:154)
              at org.apache.felix.framework.util.SecureAction.stopActivator(SecureAction.java:662)
              at org.apache.felix.framework.Felix.stopBundle(Felix.java:2071)
              at org.apache.felix.framework.BundleImpl.stop(BundleImpl.java:951)
              at org.apache.felix.framework.BundleImpl.stop(BundleImpl.java:938)
              at org.jvnet.hk2.osgiadapter.OSGiModuleImpl.detach(OSGiModuleImpl.java:249)
              at org.jvnet.hk2.osgiadapter.OSGiModuleImpl.stop(OSGiModuleImpl.java:227)
              at com.sun.enterprise.v3.admin.StopDomainCommand.execute(StopDomainCommand.java:86)
              at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
              at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.run(CommandRunnerImpl.java:333)