Re: ClassNotFoundException when deserializing persisted sessions
On Wed, Oct 14, 2009 at 5:09 PM, Manlio Malaidini wrote: > I'll check bugzilla and eventually file a bug, thanks. Bug filed as 48007 https://issues.apache.org/bugzilla/show_bug.cgi?id=48007 MM - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: ClassNotFoundException when deserializing persisted sessions
On Wed, Oct 14, 2009 at 3:00 PM, Christopher Schultz wrote: > Hmm... would you be willing to hack Tomcat's code a bit? I would, but I'd rather not: we don't control every environment where we deploy our software, hence it may be impossible to deploy a patched version of Tomcat. > If you modify > the method that is trying to load the objects from the FileStore, you > can probably ask it what the thread's context ClassLoader is... it > should be the same as your webapp's ClassLoader, and it should be being > used to load those classes. > > You might want to file a bugzilla entry for this, or look to see if one > exists like this and perhaps has a solution. I'll check bugzilla and eventually file a bug, thanks. > > I can't imagine that Tomcat has a bug and you're the only one to find > out about it, but someone's got to be the first one to report a problem > that exists, right? True. :) OTOH, a colleague has an idea about using a lazy deserializer that should be immune to this problem. Thanks, MM - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: ClassNotFoundException when deserializing persisted sessions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Manlio, On 10/14/2009 2:30 PM, Manlio Malaidini wrote: > On Wed, Oct 14, 2009 at 2:13 PM, Christopher Schultz > wrote: >> Oh, it looks like you are using explicit session persistence for >> /in-use/ sessions. > > Indeed. > >> I apologize for confusing the issue: I am using >> Tomcat's simple session-persistence-during-restart capabilities, which >> may or may not use the same code. > > Oh, don't worry, no need to apologize. Yes, I believe that it's > different Tomcat's code. > >> This configuration looks fine to me, though I don't have any experience >> with active-session persistence. >> >> Does this just happen randomly, without any code updates or anything >> like that? > > It happens every time: I just interact with the application, wait up > to 1 minute and bang, got the exception. Hmm... would you be willing to hack Tomcat's code a bit? If you modify the method that is trying to load the objects from the FileStore, you can probably ask it what the thread's context ClassLoader is... it should be the same as your webapp's ClassLoader, and it should be being used to load those classes. You might want to file a bugzilla entry for this, or look to see if one exists like this and perhaps has a solution. I can't imagine that Tomcat has a bug and you're the only one to find out about it, but someone's got to be the first one to report a problem that exists, right? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkrWH+QACgkQ9CaO5/Lv0PDaxACfQfoHlgFKJEEXoXqy4Pt9OMNX NeMAn3n8RrU/EFqX0oc8wvxSjeRpJRWh =MbUw -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: ClassNotFoundException when deserializing persisted sessions
On Wed, Oct 14, 2009 at 2:13 PM, Christopher Schultz wrote: > Oh, it looks like you are using explicit session persistence for > /in-use/ sessions. Indeed. > I apologize for confusing the issue: I am using > Tomcat's simple session-persistence-during-restart capabilities, which > may or may not use the same code. Oh, don't worry, no need to apologize. Yes, I believe that it's different Tomcat's code. > This configuration looks fine to me, though I don't have any experience > with active-session persistence. > > Does this just happen randomly, without any code updates or anything > like that? It happens every time: I just interact with the application, wait up to 1 minute and bang, got the exception. MM - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: ClassNotFoundException when deserializing persisted sessions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Manlio, On 10/14/2009 1:59 PM, Manlio Malaidini wrote: > On Wed, Oct 14, 2009 at 12:53 PM, Christopher Schultz > wrote: >> Is this happening in production,or only in development? > > Development. > >> Could [serialVersionId] be your problem? > > I don't think so, because I don't redeploy anything before receiving > this exception: > > SEVERE: Session: 6D026DD0479F48B331D28EE8325095BB; > java.lang.ClassNotFoundException: com.whatever.spikes.session.CustomClass [snip] > at org.apache.catalina.session.FileStore.load(FileStore.java:296) > at > org.apache.catalina.session.StoreBase.processExpires(StoreBase.java:194) > at > org.apache.catalina.session.PersistentManagerBase.processExpires(PersistentManagerBase.java:553) > at > org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:664) > at > org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1285) > at > org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570) [snip] >> I have persistent sessions working just fine in Tomcat 5.5.26 with >> custom objects defined only in WEB-INF/classes. > > Are you saying that you're using FileStore or PersistentStore with a > configuration like the following ones and it just works? Oh, it looks like you are using explicit session persistence for /in-use/ sessions. I apologize for confusing the issue: I am using Tomcat's simple session-persistence-during-restart capabilities, which may or may not use the same code. > docBase="/Users/mman/Workspaces/Spikes" > workDir="/Users/mman/Workspaces/Spikes/work" > > className="org.apache.catalina.session.PersistentManager" > maxIdleBackup="0" > > className="org.apache.catalina.session.FileStore" > directory="/Users/mman/tmp/tomcat-sessions"/> > > This configuration looks fine to me, though I don't have any experience with active-session persistence. Does this just happen randomly, without any code updates or anything like that? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkrWFNYACgkQ9CaO5/Lv0PBRggCfZ5VFjTtq20YJ/sZT6Ra1QSdV e2QAniUa/qHFuNA+kLju6WvQso+AUrTe =gpKj -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: ClassNotFoundException when deserializing persisted sessions
On Wed, Oct 14, 2009 at 12:53 PM, Christopher Schultz wrote: > Is this happening in production,or only in development? Development. A couple of words about my environment: *) Mac OS/X 10.6.1 *) JDK 1.6.0_15 *) Tomcat 5.5.27 > I ask because each Class has a serialVersionId which essentially > versions the Class. If you recompile the Class after making changes to > any method signature, member, or even the order of these items, the > version id changes and de-serialization fails. > > This often happens when you are working on the FooBean class, which has > ab object stored in the session. You redeploy your webapp after > deploying your new code, and Tomcat fails to re-load the session data > because there is a Class mismatch between the data being loaded from the > session and the Class available to the JVM. > > Could this be your problem? I don't think so, because I don't redeploy anything before receiving this exception: SEVERE: Session: 6D026DD0479F48B331D28EE8325095BB; java.lang.ClassNotFoundException: com.whatever.spikes.session.CustomClass at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:319) at java.lang.ClassLoader.loadClass(ClassLoader.java:254) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:399) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:604) at org.apache.catalina.util.CustomObjectInputStream.resolveClass(CustomObjectInputStream.java:78) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1407) at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:931) at org.apache.catalina.session.FileStore.load(FileStore.java:296) at org.apache.catalina.session.StoreBase.processExpires(StoreBase.java:194) at org.apache.catalina.session.PersistentManagerBase.processExpires(PersistentManagerBase.java:553) at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:664) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1285) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559) at java.lang.Thread.run(Thread.java:637) > I have persistent sessions working just fine in Tomcat 5.5.26 with > custom objects defined only in WEB-INF/classes. Are you saying that you're using FileStore or PersistentStore with a configuration like the following ones and it just works? If so, then I'm wondering what am I doing wrong... Thanks MM - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: ClassNotFoundException when deserializing persisted sessions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Manlio, On 10/14/2009 12:30 PM, Manlio Malaidini wrote: > I've come across a problem that I haven't found a clear solution yet > (despite some extensive time spent on google & books). If you persist > sessions for example with FileStore, everything is fine & dandy except > for when you start putting custom objects in the session: when I do > so, I get a ClassNotFoundException when tomcat tries to deserialize > the session. Is this happening in production,or only in development? I ask because each Class has a serialVersionId which essentially versions the Class. If you recompile the Class after making changes to any method signature, member, or even the order of these items, the version id changes and de-serialization fails. This often happens when you are working on the FooBean class, which has ab object stored in the session. You redeploy your webapp after deploying your new code, and Tomcat fails to re-load the session data because there is a Class mismatch between the data being loaded from the session and the Class available to the JVM. Could this be your problem? > I think that this happens because the Shared class loader doesn't know > about the classes in your webapp and in fact I've managed to make it > work by deploying my classes under $CATALINA_BASE/shared/lib. I have persistent sessions working just fine in Tomcat 5.5.26 with custom objects defined only in WEB-INF/classes. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkrWAgwACgkQ9CaO5/Lv0PBeugCfWi9lPn+n8SHgALK/e8rfIHMp DQkAn2pY1+0goRvYB4M1WucS/VI8Kv4W =3FJZ -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
ClassNotFoundException when deserializing persisted sessions
Hi all, I've come across a problem that I haven't found a clear solution yet (despite some extensive time spent on google & books). If you persist sessions for example with FileStore, everything is fine & dandy except for when you start putting custom objects in the session: when I do so, I get a ClassNotFoundException when tomcat tries to deserialize the session. I think that this happens because the Shared class loader doesn't know about the classes in your webapp and in fact I've managed to make it work by deploying my classes under $CATALINA_BASE/shared/lib. This is not an option in one of my webapps though. Is there any way to solve this under Tomcat 5.5 or Tomcat 6 by configuration? What I mean is: is there any way to force the usage of a specific webapp classloader when dealing with persisted sessions? Thanks in advance, MM - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org