Hey!

It's your code.

Take this out of the init()
context = getServletContext()  //is there a good reason for here?

Put it into the service();

ServletContext context = getServletContext();

This is not a very expensive operation.

Sans adieu,
Danny Rubis




Andi Setiyadi wrote:

> I am using JRun 3.0 on NT and I experienced weird situation here. For the
> last couple days, JRun server quits abnormally, even when executing a very
> simple servlet task.  I post my servlet codes below.  It was running before
> no problem, this problem just occurred 2 days ago.
> Anybody has experienced this problem before?
>
> Thanks,
> Andi
>
> package com.wg.hr;
>
> import ...;
>
> public class Personnet extends HttpServlet
> {
>      ...
>      public void init(ServletConfig config) throws ServletException    {
>           super.init(config);
>           setTargetPages();
>           context = getServletContext();
>      }
>
>      public void doGet(HttpServletRequest req, HttpServletResponse res)
> throws IOException, ServletException     {
>
>           req.setAttribute("context", context);
>           PrintWriter out = res.getWriter();
>
>           targetPage = "comejsp.jsp";
>
>           RequestDispatcher rd = context.getRequestDispatcher("/" +
> targetPage);
>           rd.forward(req, res);
>      }
>
>      public void doPost(HttpServletRequest req, HttpServletResponse res)
> throws IOException, ServletException     {
>           doGet(req, res);
>      }
> }
>
> ___________________________________________________________________________
> 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