Default persistence/serialization?
Does Tomcat, by default, serialize a session (or anything else)? I'm getting a NotSerializableException when attempting to perform a HttpServletRequest.forward() from inside a servlet. The NotSerializableException refers to a java bean that is called from the JSP page that is the object of the forward(). The jsp:useBean ... call specifies the bean's scope as request. The class in question is not serializable, but it should not be (at least not as far a my code is concerned). This servlet is working properly with other JSP pages and other beans that are not serializable. Of course, I could declare it serializable but it really shouldn't ever be serialized and I'd like to understand what's going on. I haven't found anything relevant in the servlet spec. I'm currently running Tomcat/5.0.19 as a standalone server. For what it's worth, the error message (from the logfile) is below.* *I'd appreciate any thoughts on this matter. Thanks, bw May 23, 2004 2:00:12 PM org.apache.catalina.session.StandardManager start SEVERE: Exception loading sessions from persistent storage java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: beaststore.SupplierOrder at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1278) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274) at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1603) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1271) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324) at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1376) at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:920) at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:463) at org.apache.catalina.session.StandardManager.load(StandardManager.java:390) at org.apache.catalina.session.StandardManager.start(StandardManager.java:704) at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:542) at org.apache.catalina.startup.ContextConfig.managerConfig(ContextConfig.java:348) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:652) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:253) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4222) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:850) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:638) at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:320) at org.apache.catalina.core.StandardHost.install(StandardHost.java:875) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:727) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:477) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1008) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:394) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1134) at org.apache.catalina.core.StandardHost.start(StandardHost.java:832) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1126) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:521) at org.apache.catalina.core.StandardService.start(StandardService.java:519) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2345) at org.apache.catalina.startup.Catalina.start(Catalina.java:594) 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:324) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398) Caused by: java.io.NotSerializableException: beaststore.SupplierOrder at
Re: Default persistence/serialization?
On Sun, May 23, 2004 at 02:25:27PM -0500, Barnet Wagman wrote: : Does Tomcat, by default, serialize a session (or anything else)? 1/ Tomcat loads/stores sessions by default on container startup/shutdown. See the last item on: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/manager.html For the archives, the excerpt from that page is: - - - begin - - - Special Features Restart Persistence Whenver Catalina is shut down normally and restarted, or when an application reload is triggered, the standard Manager implementation will attempt to serialize all currently active sessions to a disk file located via the pathname attribute. All such saved sessions will then be deserialized and activated (assuming they have not expired in the mean time) when the application reload is completed. In order to successfully restore the state of session attributes, all such attributes MUST implement the java.io.Serializable interface. You MAY cause the Manager to enforce this restriction by including the distributable element in your web application deployment descriptor (/WEB-INF/web.xml). - - - end - - - 2/ The spec (sort of) requires that session attrs be serializable: sec 7.7.2 for 2.3 and 2.4 requires it for distributed/clustered containers (and leaves the handling of non-clustered configuration to container implementors). -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]