tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mélanie langlois <>
Subject Re: nullpointerexception with standard manager
Date Thu, 10 May 2007 02:27:55 GMT

Thank you for your explanation.

Actually, we don't need this feature in our application, so i want to 
disable the persistence of session. However, we are running tomcat 5.0.28 
and for several reasons, we don't want to upgrade for now. Is it possible to 
disable this in 5.0.28 ? I saw only explanation for doing this on tomcat 
5.5.x by modifying context.xml ..



>From: David Delbecq <>
>Reply-To: "Tomcat Users List" <>
>To: Tomcat Users List <>
>Subject: Re: nullpointerexception with standard manager
>Date: Mon, 07 May 2007 10:36:27 +0200
>The standardmanager persist sessions across reload using serialization.
>That mean all object in session must be serializable.
>An object is serializable if
>1) it implements the Serializable interface (see also the externalizable
>interface which give more control on serialization)
>2) it has an no-parameter constructor
>3) all it's instance fields are serializable
>The serialization process does not store or restore static field,
>because those are class wide and not related to object instance.
>En l'instant précis du 07/05/07 09:20, mélanie langlois s'exprimait en
>ces termes:
> > Hello,
> >
> > We are running tomcat 5.0.28, and we have a problem with the
> > standardManager when restarting our application. We have a
> > NullPointerException when the StandardManager loads a session
> > object.This object has static fields calling another class method (to
> > obtain the bundles key for some page title). However, this second
> > class has not been iniatlized yet,
>Ok, you have class A static initialization assume some class B static
>methods calls were before (maybe during a servlet initialization , a
>context listerner or filter job), this is a big design problem, you can
>not easily be sure of when class A will be static initialized by
>classloader. This is weak design as it's very difficult to be 100% sure
>of class initialization order in a code.
> > and I can see that the standard Manager initialize this class after.
> > But it's too late, the NullPointerException makes it impossible to
> > access the index page properly. We need to restart.
>Standard Manager does not initialize classes, it initialize instances of
>those classes. It's the classloader that does the job of static
>initialization of classes.
> > How does the standard manager works ? Does it try to load all static
> > objects first ?
>persistence is done only on object instances, the classloader does
>static initialization of class members, standardManager does
>unserialization, all  unserialization does is a Object o =
>someClass.newInstance(); and then put unserialized values in 'o' fields.
> > Why the startup is working fine when the standard manager is not
> > launched (no session persisted )?
>Because order in which your classloader statically initialize your
>classes is not the same if you don't try at startup to unserialize user
>Possible solutions:
>1) revise design of your session objects, those should be serializable
>to be in session. Move the static field to another object shared by all
>2) Don't put this problematic object in the session.
>3) Don't use session persistence (aka don't use a Manager)
> >
> > Thanks,
> >
> > Mélanie
> >
> > _________________________________________________________________
> > Gagnez des pc Windows Vista avec
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail:
> > To unsubscribe, e-mail:
> > For additional commands, e-mail:
> >
>To start a new topic, e-mail:
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Personnalisez votre Messenger avec

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message