Hi,
Thanks to the repliers (no-JIT/debugging).
Craig, thanks for pointing out another flaw (multiple users).
Will try out and post result.
Vasudev

> -----Original Message-----
> From: Craig R. McClanahan [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, November 19, 1999 2:24 AM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Bug in servlet program
>
> RVASUDEV wrote:
>
> > Hi servlet gurus,
> >
> > Env:
> > HP-UX 10.20, Java 1.17, JSDK 2.1
> >
> > There's a small servlet I've written, that calls the UNIX "uptime" and
> "w"
> > commands using a Process object, reads their output and displays it
> > back to the user. It gives the error shown below at the printW() method
> > (blank/irrelevant lines deleted from program and output). You have
> > to run the servlet, check the w checkbox, then click the submit button
> > to generate the error. Any ideas ? There is no indication of which
> > line the error is occurring on, though an earlier bug (also a NPE) was
> fixed
> > after seeing the line no. in the error msg.
> >
>
> Suggestions:
>
> * Compile your servlet without optimization, and turn off the JIT at run
> time
>   so that line numbers will be included in the traceback.
>
> * Execute this under a debugger, or add a whole bunch more
>   debugging print statements inside the printW() method.
>
> Debugging servlets is no different than debugging any other program --
> you've
> got to narrow down where your problems are occurring.
>
> However, even after you fix this particular bug, you will soon find out
> that
> this servlet will fail horribly when two or more people try to use it at
> the
> same time.  This is caused by the fact that you are using instance
> variables
> (like srvOut, prcOut, and so on) instead of method variables and/or
> arguments.
> There is only one copy of these variables, so simultaneous access on
> multiple
> threads is going to scribble on them.
>
> >
> > TIA
> > Vasudev
> >
>
> Craig McClanahan
>
> __________________________________________________________________________
> _
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to