ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicholoz Koka Kiknadze <kikna...@gmail.com>
Subject Re: "Cannot serialize session attribute ..."
Date Fri, 20 Mar 2009 14:50:00 GMT
I have never used tomcat clustering, but it sounds to me reasonable that
disabling persisting sessions upon tomcat exit has nothing to do with
clustering. However, in order to replicate session object in clustered
environment the session object *has to be* serializable. So, imho, any
reference to singleton objects in your session can be and must be marked
with 'transient'.


On Fri, Mar 20, 2009 at 7:53 AM, Leffingwell, Jonathan R CTR FRCSE, JAX
7.2.2 <jonathan.leffingwell.ctr@navy.mil> wrote:

> Here's my concern:
>
> Let's say that I am running two instances of Tomcat in a cluster: Server A
> and Server B.  While a user is in the web application on Server A, Server A
> goes down.  I need for Server B to have all of the session information for
> the user that Server A had, so the user will not notice anything while
> he/she is using the web app.  That's why we're using clustering.
>
> If the web application is properly exited, then I don't care if the session
> information is saved upon exiting the app.  It's probably better if the
> session info is NOT saved upon properly exiting the app.  But what I want
> to
> know is this:  If I use any of the previously mentioned solutions (i.e. the
> <Manager pathname=""/> or the <Manager
> className="org.apache.catalina.session.PersistentManager"
> saveOnRestart="false" /> approaches), will my clustering still work as I
> need it to?
>
> Thank you for your help, everyone!
>
> Jonathan
>
>
> -----Original Message-----
> From: charlie bird [mailto:zebthecat@yahoo.co.uk]
> Sent: Friday, March 20, 2009 7:46 AM
> To: user-java@ibatis.apache.org
> Subject: Re: "Cannot serialize session attribute ..."
>
>
> Alternatively you could disable session serialization completely by adding
> the following line to your tomcat application xml:
>
> <Manager pathname=""/>
>
> Only if you're not bothered about retrieving the sessions on restart of
> course
>
>
> --- On Fri, 20/3/09, Kengkaj Sathianpantarit <kengkaj.s@gmail.com> wrote:
>
> > From: Kengkaj Sathianpantarit <kengkaj.s@gmail.com>
> > Subject: Re: "Cannot serialize session attribute ..."
> > To: user-java@ibatis.apache.org
> > Date: Friday, 20 March, 2009, 11:18 AM Mark transient in declaration -
> > transient StandardDaoManager standardDaoManager;
> >
> > Kengkaj
> >
> > On Fri, Mar 20, 2009 at 6:13 PM,
> > Leffingwell, Jonathan R CTR FRCSE, JAX 7.2.2
> > <jonathan.leffingwell.ctr@navy.mil>
> > wrote:
> >
> > What does that mean, "set
> > reference to it transient"?
> >
> >
> >
> >
> >
> > -----Original Message-----
> >
> > From: Nicholoz Koka Kiknadze [mailto:kiknadze@gmail.com]
> >
> > Sent: Thursday, March 19, 2009 3:30 PM
> >
> > To: user-java@ibatis.apache.org
> >
> > Subject: Re: "Cannot serialize session attribute ..."
> >
> >
> >
> > My first thought is that maybe StandardDaoManager can not be
> > serializable as
> >
> > it deals with database connections. Maybe makes sense to set reference
> > to it
> >
> > transient?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Thu, Mar 19, 2009 at 2:55 PM, Leffingwell, Jonathan R CTR FRCSE,
> > JAX
> >
> > 7.2.2 <jonathan.leffingwell.ctr@navy.mil>
> > wrote:
> >
> >
> >
> >
> >
> >         I am running a web app in IBM RAD 7 with a Tomcat 5.5.26
> > server,
> >
> > with
> >
> >         clustering (two Tomcat instances).  When shutting down the
> > Tomcat
> >
> > server(s),
> >
> >         I get the following warning:
> >
> >
> >
> >         Mar 19, 2009 2:52:43 PM
> > org.apache.catalina.session.StandardSession
> >
> >         writeObject
> >
> >         WARNING: Cannot serialize session attribute createXXXManager
> > for
> >
> > session
> >
> >         8B1876E5C5C54B242E4256674843600B
> >
> >         java.io.NotSerializableException:
> >
> >         com.ibatis.dao.engine.impl.StandardDaoManager
> >
> >                at
> >
> >
> >
> > java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
> >
> >                at
> >
> >
> >
> > java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:
> > 1375)
> >
> >                at
> >
> >
> >
> > java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:134
> > 7)
> >
> >                at
> >
> >
> >
> > java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java
> > :1290)
> >
> >                at
> >
> >
> >
> > java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
> >
> >                at
> >
> >
> >  java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
> >
> >                at
> >
> >
> >
> > org.apache.catalina.session.StandardSession.writeObject(StandardSessio
> > n.java
> >
> >         :1478)
> >
> >                at
> >
> >
> >
> >
>
> org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.
> >
> >         java:948)
> >
> >                at
> >
> >
> >
> > org.apache.catalina.session.StandardManager.doUnload(StandardManager.j
> > ava:51
> >
> >         7)
> >
> >                at
> >
> >
> >
> > org.apache.catalina.session.StandardManager.unload(StandardManager.jav
> > a:463)
> >
> >                at
> >
> >
> >
> > org.apache.catalina.session.StandardManager.stop(StandardManager.java:
> > 667)
> >
> >                at
> >
> >
> >
> > org.apache.catalina.core.StandardContext.stop(StandardContext.java:436
> > 0)
> >
> >                at
> >
> >
> >  org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1067)
> >
> >                at
> >
> >
> >  org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1067)
> >
> >                at
> >
> >
> >
> > org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448)
> >
> >                at
> >
> >
> >
> > org.apache.catalina.core.StandardService.stop(StandardService.java:510
> > )
> >
> >                at
> >
> >
> >
> > org.apache.catalina.core.StandardServer.stop(StandardServer.java:734)
> >
> >                at
> >
> > org.apache.catalina.startup.Catalina.stop(Catalina.java:602)
> >
> >                at
> >
> > org.apache.catalina.startup.Catalina.start(Catalina.java:577)
> >
> >                at
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >
> > Method)
> >
> >                at
> >
> >
> >
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> > ava:39
> >
> >         )
> >
> >                at
> >
> >
> >
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > orImpl
> >
> >         .java:25)
> >
> >                at
> > java.lang.reflect.Method.invoke(Method.java:585)
> >
> >                at
> >
> > org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
> >
> >                at
> >
> > org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
> >
> >
> >
> >
> >
> >         All of my managers, including createXXXManager, inherit from a
> >
> > serializable
> >
> >         class BaseManager, but if I'm reading this correctly, it looks
> > like
> >
> > the
> >
> >         iBatis class StandardDaoManager is not serializable.  I can't
> > edit
> >
> > that
> >
> >         class, of course.
> >
> >
> >
> >         Here's what I want to know:
> >
> >
> >
> >         1.  If I put the following code in my context.xml file, will
> > it
> >
> > prevent
> >
> >         clustering from working properly?
> >
> >
> >
> >         <Manager
> > className="org.apache.catalina.session.PersistentManager"
> >
> >         saveOnRestart="false" />
> >
> >
> >
> >
> >
> >         2.  If the aforementioned context.xml snippet keeps clustering
> > from
> >
> > working,
> >
> >         what options do I have to stop the warnings but keep
> > clustering
> >
> > working
> >
> >         properly?
> >
> >
> >
> >
> >
> >         Thanks for any insight!
> >
> >
> >
> >         Jonathan
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>
>

Mime
View raw message