tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Mixon (qwest)" <rnmi...@qwest.net>
Subject RE: NPE in ActionForm where it is not be possible
Date Tue, 13 Jul 2004 22:26:04 GMT
QM <mailto:qm300@brandxdev.net> wrote:
> On Sat, Jul 10, 2004 at 12:31:21PM -0700, Richard Mixon (qwest) wrote:
>> The "log" variable is initialized when the Action form is
>>   instantiated, like so: public class ChartWizardForm extends
>>       ActionForm implements java.io.Serializable { private transient
>> Log log =
>> LogFactory.getLog(ChartWizardForm.class);
>>       ...
>>
>> Obviously I'm missing something pretty basic. Is Tomcat re-using a
>> form instance across restarts? I've got pretty much default settings
>> in Tomcat:
>
> I notice, you define/initialize the instance variable "log" at its
> declaration point.
>
> Humor me: what happens if you initialize "log" in the ctor?
>
> -QM

I've had to look at higher priorities for a couple of days :)

Thanks for the idea. I changed as follows:
    ...
    // private transient Log log =
LogFactory.getLog(ChartWizardForm.class);
    private transient Log log; // Logging instance for this class
    ...

    public ChartWizardForm() {
        showInactive = false;
        altClassMeasOrder = false;
        ...
        outputFmt="";
        scaleFactor="";
        log = LogFactory.getLog(ChartWizardForm.class); // <-- ADDED
INITIALIZATION HERE
    }
    ...

But, still get the NPE :(

I'm defininig the instance variable as transient because Tomcat
complains about saving sessions that contain a private instance variable
(non-transient) of type Log. I was trying to get my sessions to persist
across restarts. Does that suggest anything?

Thank you again - Richard


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message