Bug 34127 - Session serialization fails
Session serialization fails
Status: RESOLVED FIXED
Product: Lenya
Classification: Unclassified
Component: Miscellaneous
1.2.2
Other other
: P2 normal
: 1.4
Assigned To: Lenya Developers
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-03-22 16:08 UTC by Mirek Hankus
Modified: 2005-05-08 15:12 UTC (History)
0 users



Attachments
Patch making some classes serializable (2.31 KB, patch)
2005-03-29 11:30 UTC, Mirek Hankus
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mirek Hankus 2005-03-22 16:08:17 UTC
Objects stored in HTTP Session should be serializable. Right now when you try 
to reload application (tomcat 5.5.8) you will get java.io.NotSerializableException.

Stack trace is

WARN 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/lenya].writeObject():1442
 - Cannot serialize sessionattribute org.apache.lenya.ac.Identity for session
9E47AB9939F10F7A030B68CEC3039B8F
java.io.NotSerializableException: org.apache.lenya.ac.World
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
        at java.util.HashSet.writeObject(HashSet.java:254)
        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:585)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
        at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:380)
        at org.apache.lenya.ac.Identity.writeObject(Identity.java:51)
        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:585)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
        at
org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1436)
        at
org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:911)
        at
org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:516)
        at
org.apache.catalina.session.StandardManager.unload(StandardManager.java:462)
        at
org.apache.catalina.session.StandardManager.stop(StandardManager.java:664)

and so on...


Same exception for org.apache.lenya.ac.file.FileUser. Others will show when this 
will be fixed. 

Without this lenya cannot be run in a cluster. On systems with only one tomcat,
sessions are lost.
Comment 1 Gregor J. Rothfuss 2005-03-22 16:52:58 UTC
would you mind to send a patch?
Comment 2 Gregor J. Rothfuss 2005-03-26 23:33:36 UTC
i applied your FileUser patch, and you mentioned that there are other areas
where it throws errors. could you name them here?
Comment 3 Mirek Hankus 2005-03-29 11:30:41 UTC
Created attachment 14581 [details]
Patch making some classes serializable

Here is a patch with some classes made serializable. 

In o.a.l.ac.World I moved initialization of instance variable from getInstance
to  
static initializer.

Right now session sometimes do serialize sometimes not. New exception is raised
(see below). Object causing this exception is  not from lenya source, but I
don't know what to do about that. Is it a bug in Cocoon or maybe object does
not have to be stored in session ?? Any ideas what to do about that ?

Mirek


1869394 2005-03-29 10:51:19,425 [http-8080-Processor23] WARN 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].
[/len1].writeObject():1451  - Cannot serialize session attribute FOM JavaScript
GLOBAL SCOPE/file:/opt/jakarta-tomcat-5.5.9/
webapps/len1/lenya/admin.xmap:24:35 for session
4A754EE52F9E3E6AF53FF88F8BE5EC28
java.io.NotSerializableException:
org.apache.cocoon.components.flow.javascript.fom.CompilingClassLoader
	at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
	at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
	at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
	at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
	at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
	at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
	at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
	at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
	at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
	at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)
	at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)
	at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
	at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
	at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
	at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
	at
org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1445)

	at
org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:920)
Comment 4 Gregor J. Rothfuss 2005-03-30 06:02:40 UTC
(In reply to comment #3)

> Here is a patch with some classes made serializable. 

thanks, i will take a look.

> Right now session sometimes do serialize sometimes not. New exception is raised
> (see below). Object causing this exception is  not from lenya source, but I
> don't know what to do about that. Is it a bug in Cocoon or maybe object does
> not have to be stored in session ?? Any ideas what to do about that ?

this is a known issue: http://issues.apache.org/bugzilla/show_bug.cgi?id=33324

basically, until cocoon figures out how to serialize flow, this will be a problem
Comment 5 Gregor J. Rothfuss 2005-05-08 23:12:57 UTC
thanks, applied