Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 19682 invoked from network); 10 May 2007 02:28:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 May 2007 02:28:34 -0000 Received: (qmail 34779 invoked by uid 500); 10 May 2007 02:28:28 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 34534 invoked by uid 500); 10 May 2007 02:28:27 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 34523 invoked by uid 99); 10 May 2007 02:28:27 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2007 19:28:27 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=MSGID_FROM_MTA_HEADER,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of melane80@hotmail.fr designates 65.54.246.173 as permitted sender) Received: from [65.54.246.173] (HELO bay0-omc2-s37.bay0.hotmail.com) (65.54.246.173) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2007 19:28:20 -0700 Received: from hotmail.com ([65.54.169.43]) by bay0-omc2-s37.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Wed, 9 May 2007 19:27:59 -0700 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 9 May 2007 19:27:59 -0700 Message-ID: Received: from 65.54.169.200 by by114fd.bay114.hotmail.msn.com with HTTP; Thu, 10 May 2007 02:27:55 GMT X-Originating-IP: [122.208.146.189] X-Originating-Email: [melane80@hotmail.fr] X-Sender: melane80@hotmail.fr In-Reply-To: <463EE50B.2000003@oma.be> From: =?iso-8859-1?B?belsYW5pZSBsYW5nbG9pcw==?= To: users@tomcat.apache.org Subject: Re: nullpointerexception with standard manager Date: Thu, 10 May 2007 04:27:55 +0200 Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed X-OriginalArrivalTime: 10 May 2007 02:27:59.0350 (UTC) FILETIME=[D37B0960:01C792AA] X-Virus-Checked: Checked by ClamAV on apache.org Hi, 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 .. Thanks, M�lanie >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 >session. > >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 >users. >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 Live.com http://www.image-addict.fr/ > > > > > > --------------------------------------------------------------------- > > To start a new topic, e-mail: users@tomcat.apache.org > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > > For additional commands, e-mail: users-help@tomcat.apache.org > > > > >--------------------------------------------------------------------- >To start a new topic, e-mail: users@tomcat.apache.org >To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >For additional commands, e-mail: users-help@tomcat.apache.org > _________________________________________________________________ Personnalisez votre Messenger avec Live.com http://www.windowslive.fr/livecom/ --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org