Srinivas:

        I can't comment on Jrun or Weblogic, since I haven't used them.  Normally I
figure that since Tomcat is the officially sanctioned reference
implementation, if it doesn't work on Tomcat, it just plain doesn't work,
even if it does work on other containers.

        Here's what the servlet API docs say about getParameter in
ServletRequest.getParameter() :
"If the parameter data was sent in the request body, such as occurs with an
HTTP POST request, then reading the body directly via getInputStream() or
getReader() can interfere with the execution of this method."

        I take that to mean it may cause problems, but won't necessarily, depending
on the implementation.

        Can you try out the workaround I suggested and see if it solves the
problem?  If it doesn't, then we're on the wrong debugging track anyway.

Greg Trasuk, President
StratusCom Manufacturing Systems Inc. - We use information technology to
solve business problems on your plant floor.
http://stratuscom.ca

-----Original Message-----
From: Sampige, Srinivas [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 18, 2001 11:56 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Bug in Tomcat ? - forwarding HTTP request from a Servlet to
a JSP


Greg
 Also ,the same thing works great in weblogic also in addition to JRun.Any
ideas ??
-Srinivas

-----Original Message-----
From: Greg Trasuk [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 10:08 PM
To: [EMAIL PROTECTED]
Subject: RE: Bug in Tomcat ? - forwarding HTTP request from a Servlet to
a JSP


Hello:

        From what I can tell:

        (1) In your PronServlet.java service() method, you are manually parsing the
form data using the stream returned by request.getInputStream()
        (2) In the JSP page, Tomcat is attempting to parse the form data again.

        The servlet API docs specify that you can only call getInputStream() once
on a request, and that doing so may cause problems reading parameters, so I
suspect that's the source of your problem.  I'm not entirely sure why the
generated JSP servlet is trying to read the parameters. Perhaps you're using
the parameters in the JSP page, or perhaps the JSP engine just reads it by
default, which would seem reasonable to me.

        The simple workaround would be not to parse the form data in your
PronServlet, but to just use request.getParameter() and let Tomcat handle
it.  That's the way I've done it in the past, and haven't had problems.

Greg Trasuk, President
StratusCom Manufacturing Systems Inc. - We use information technology to
solve business problems on your plant floor.
http://stratuscom.ca

-----Original Message-----
From: Sampige, Srinivas [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 5:59 PM
To: [EMAIL PROTECTED]
Subject: Bug in Tomcat ? - forwarding HTTP request from a Servlet to a
JSP


Hi
 Iam using tomcat 3.2.1 and i have a servlet "PronServlet" that extends from
HttpServlet . Now i have a servlet "LogonServlet" that extends from servlet
"PronServlet" (which has got common functionality like checking for a valid
session ;has common methods that perform functionality like forwarding HTTP
request to another url). In "LogonServlet" i have some code that does some
processing and finally forwards the HTTP request to a JSP .Iam getting an
error which iam pasting below.I ran the same application on JRun and it
works fine .I noticed that if i removed the subclassing and instead
subclassed LogonServlet directly from HttpServlet then the application works
fine by forwarding the request to the next JSP .Here is the console output
.Iam attaching the source code of
 PronServlet and LogonServlet .Anybody from the Tomcat dev team any
ideas..... ?

----------------------------------------------------------------------------
------------------------------
Creating a session for the user...
Forwarding request to the MENU page...
2001-07-17 02:17:22 - Ctx( /pron ): Exception in: R( /pron +
/webUi/pronMenu.jsp + null) - java.lang.
IllegalArgumentException: Short Read
        at javax.servlet.http.HttpUtils.parsePostData(HttpUtils.java:238)
        at
org.apache.tomcat.util.RequestUtil.readFormData(RequestUtil.java:101)
        at
org.apache.tomcat.core.RequestImpl.handleParameters(RequestImpl.java:691)
        at
org.apache.tomcat.core.RequestImpl.getParameterValues(RequestImpl.java:259)
        at
org.apache.tomcat.core.RequestImpl.getParameter(RequestImpl.java:250)
        at
org.apache.tomcat.facade.HttpServletRequestFacade.getParameter(HttpServletRe
questFacade.ja
va:222)
        at
org.apache.jasper.servlet.JspServlet.preCompile(JspServlet.java:326)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:370)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
        at org.apache.tomcat.core.Handler.service(Handler.java:286)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at
org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl
.java:194)
        at
com.boeing.pron.servlets.LogonServlet.handleApplicationEvent(LogonServlet.ja
va:61)
        at com.boeing.pron.servlets.PronServlet.service(PronServlet.java:56)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
        at org.apache.tomcat.core.Handler.service(Handler.java:286)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandl
er.java:210)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
        at java.lang.Thread.run(Thread.java:484)
----------------------------------------------------------------------------
----------------------------------------------

 <<LogonServlet.java>>  <<PronServlet.java>>

Reply via email to