Quantcast

Missing Request Parameters

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Missing Request Parameters

rache
Parameter values are set in the jsp either as hardcoded links(http://j.jsp?param=value) or as hidden parameters. When the program enters the doGet() or doPost() method of a servlet and check for the parameter, its null.

String pvalue = req.getParameter("param");

This happens intermittently. Is there any explanation on this. Is this a bug on Tomcat or somethings wrong with my code?

Any help would be great!
Thanks!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

Ben Souther-2
Since all webapps rely on request parameters, I'd say this would be a
huge bug if it were one.  So huge that it would render Tomcat unusable
for any commercial grade application.  Such a bug would fill this list
with hundreds or thousands of complaints.

Since we're not seeing those complaints, it's probably safe to assume
it's your code.

Maybe you could post your servlet code and the HTML form or link that
sends those parameters and we can have a look.


On Fri, 2006-07-28 at 20:28, rache wrote:

> Parameter values are set in the jsp either as hardcoded
> links(http://j.jsp?param=value) or as hidden parameters. When the program
> enters the doGet() or doPost() method of a servlet and check for the
> parameter, its null.
>
> String pvalue = req.getParameter("param");
>
> This happens intermittently. Is there any explanation on this. Is this a bug
> on Tomcat or somethings wrong with my code?
>
> Any help would be great!
> Thanks!


---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

rache
That's what I was thinking - that it couldn't have been a bug :) I'm quite new to Tomcat but I know it coundn't have been one since many are using it.

I don't have any code access now since codebase is at the office. But this usually occur after redirects.
Most of the pages (servlets and those urls/links starting with http) are redirects.
URL is made in the code:
-either from a hradcoded href link
-/servlet/servletname
-/jsp/jspname.jsp

then the following methods are called:
-for any url starting with "http"
 response.sendRedirect(url);
-for any url with servlets
 response.sendRedirect(contextpath + url);
-for jsps
 getRequestDispatcher(url).forward(req, resp);

I've read something with 302 codes/redirects having to cause lost parameter/session info.
But still is new to me.

Any advise will really help!
Thanks again!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

Martin Gainty
In reply to this post by Ben Souther-2
Good Morning Ben

what is the specified method for the form?
In the eventuality of lack of method you will call service() method..

HTH,
Martin -
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message -----
From: "Ben Souther" <[hidden email]>
To: "Tomcat Users List" <[hidden email]>
Sent: Friday, July 28, 2006 9:21 PM
Subject: Re: Missing Request Parameters


> Since all webapps rely on request parameters, I'd say this would be a
> huge bug if it were one.  So huge that it would render Tomcat unusable
> for any commercial grade application.  Such a bug would fill this list
> with hundreds or thousands of complaints.
>
> Since we're not seeing those complaints, it's probably safe to assume
> it's your code.
>
> Maybe you could post your servlet code and the HTML form or link that
> sends those parameters and we can have a look.
>
>
> On Fri, 2006-07-28 at 20:28, rache wrote:
>> Parameter values are set in the jsp either as hardcoded
>> links(http://j.jsp?param=value) or as hidden parameters. When the program
>> enters the doGet() or doPost() method of a servlet and check for the
>> parameter, its null.
>>
>> String pvalue = req.getParameter("param");
>>
>> This happens intermittently. Is there any explanation on this. Is this a bug
>> on Tomcat or somethings wrong with my code?
>>
>> Any help would be great!
>> Thanks!
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: [hidden email]
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

Christopher Schultz-2
In reply to this post by rache
Rache,

> But this usually occur after redirects.

This is what I was going to ask about: if you fail to put all the
important parameters into the redirect, then you will lose them. For
example, if you have a form handler that accepts 5 request parameters,
you cannot simply say:

response.sendRedirect("/foo/bar/baz");

and expect those request parameters to be included for you. You must do
this:

response.sendRedirect("/foo/bar/baz?a=b&c=d&e=g[etc]");

> getRequestDispatcher(url).forward(req, resp);

Forwards should retain the request parameters.

> I've read something with 302 codes/redirects having to cause lost
> parameter/session info.

This is not an HTTP problem; 302 codes can include complete URLs,
including request parameters and even cookies (since they are just
stored in the HTTP headers). Check your code very carefully to see where
the parameters "disappear", and I think you'll find that you are not
building your URLs for redirection properly.

-chris



signature.asc (258 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

jon wingfield-2
Rache,

Tools like ieHTTPHeaders and LiveHTTPHeaders will also help you determine
what the browser actually sends to the server, including any redirects
caused by 302 response codes.

HTH,

Jon

> Rache,
>
>> But this usually occur after redirects.
>
> This is what I was going to ask about: if you fail to put all the
> important parameters into the redirect, then you will lose them. For
> example, if you have a form handler that accepts 5 request parameters,
> you cannot simply say:
>
> response.sendRedirect("/foo/bar/baz");
>
> and expect those request parameters to be included for you. You must do
> this:
>
> response.sendRedirect("/foo/bar/baz?a=b&c=d&e=g[etc]");
>
>> getRequestDispatcher(url).forward(req, resp);
>
> Forwards should retain the request parameters.
>
>> I've read something with 302 codes/redirects having to cause lost
>> parameter/session info.
>
> This is not an HTTP problem; 302 codes can include complete URLs,
> including request parameters and even cookies (since they are just
> stored in the HTTP headers). Check your code very carefully to see where
> the parameters "disappear", and I think you'll find that you are not
> building your URLs for redirection properly.
>
> -chris
>
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

rache
This is how the code redirects:

                if (redirectURL.toUpperCase().startsWith("/SERVLET"))
                {
                        // routing to another request to the servlet...
                        response.sendRedirect(request.getContextPath() + redirectURL);
                }
                else if (redirectURL.toUpperCase().startsWith("HTTP"))
                {
                        // routing to another request to the servlet...
                        response.sendRedirect(redirectURL);
                }
                else
                {
                        // routing to a JSP...
                        getRequestDispatcher(redirectURL).forward(request, response);
                }


-Jon, we have enabled the RequestDumperValve in the tomcat server.xml to enable request logging. That way, we are able to monitor the requests coming in. The logs helped us to see that no parameters where set in the request.

This application is connected to IIS thru the AJP connectors. Aside from the parameter-setting code which I need to check, could this connection  also cause request parameters to be dropped? I have quite a bit of a problem checking the urls with parameters set since this happens in production and happens on and off. I can't even see the page source to check on the url set since the pages aren't cached. Any tips on these?

I'm really grateful for all your inputs!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

Jon Wingfield
Erm. ok. Where does the redirectURL variable come from? Unless it has
parameters encoded into it that will be your problem.

Also, be a bit wary in using the RequestDumperValve with non-ascii
charset data as it can corrupt some parameters:
http://marc.theaimsgroup.com/?l=tomcat-user&m=112530311007782&w=2

The above (and other similar threads on this list) is why I tend to use
the browser plug-ins first.

Jon

rache wrote:

> This is how the code redirects:
>
> if (redirectURL.toUpperCase().startsWith("/SERVLET"))
> {
> // routing to another request to the servlet...
> response.sendRedirect(request.getContextPath() + redirectURL);
> }
> else if (redirectURL.toUpperCase().startsWith("HTTP"))
> {
> // routing to another request to the servlet...
> response.sendRedirect(redirectURL);
> }
> else
> {
> // routing to a JSP...
> getRequestDispatcher(redirectURL).forward(request, response);
> }
>
>
> -Jon, we have enabled the RequestDumperValve in the tomcat server.xml to
> enable request logging. That way, we are able to monitor the requests coming
> in. The logs helped us to see that no parameters where set in the request.
>
> This application is connected to IIS thru the AJP connectors. Aside from the
> parameter-setting code which I need to check, could this connection  also
> cause request parameters to be dropped? I have quite a bit of a problem
> checking the urls with parameters set since this happens in production and
> happens on and off. I can't even see the page source to check on the url set
> since the pages aren't cached. Any tips on these?
>
> I'm really grateful for all your inputs!



---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

rache
Parameters are either set this way:

1. from the page itself:
        <form class="hidden" name="cal" action="business_calendar_2.jsp" method="post">
            <input type="hidden" name="windowTitle" value="<%= windowTitle %>">
            <input type="hidden" name="headTitle" value="<%= headTitle %>">
           ....
2. from building xmls which are then integrated into the page itself which a user can click on for links:
  href="../servlet/tpservlet?transactiontype=sessionProfileActionBean&ACTIVITY_TYPE=Exit"
or
 href="../jsp/security.jsp" (no parameters needed)

I'm assuming that when a user clicks on either of this parameters should have been part of the request.

By the way, I have a silly question, can a POST method ever get changed to a GET method somewhere? Where, aside  from html forms, can these methods be set?
Also, when can a header-referer value(page where you came from) be null aside from your starting page?

Thanks again!
   
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

lmelendez
In reply to this post by rache
Hi Rache,

Well, we are seeing the problem. Our web application seems to *drop* parameters for some requests and we still don't know what it is. We have enabled Valves and Filters and it looks like the parameters never make it to tomcat.

The problem is intermitent and we cannot reproduce it at will. The same request might work sometimes and show the problem in others and we were really surprised that nobody else was having similar issues.

We are currently using Apache 2.0.55 and Tomcat 5.0.28.

I am wondering if you have more information about this.

Thanks!
Leo.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

Pid-2
(i can't see a previous thread for this, new mail setup, so apologies if
I'm restating.)


Are you using GET or POST?
And how many parameters are you submitting?
And are there any particularly long bits of data in the parameters?



lmelendez wrote:

> Hi Rache,
>
> Well, we are seeing the problem. Our web application seems to *drop*
> parameters for some requests and we still don't know what it is. We have
> enabled Valves and Filters and it looks like the parameters never make it to
> tomcat.
>
> The problem is intermitent and we cannot reproduce it at will. The same
> request might work sometimes and show the problem in others and we were
> really surprised that nobody else was having similar issues.
>
> We are currently using Apache 2.0.55 and Tomcat 5.0.28.
>
> I am wondering if you have more information about this.
>
> Thanks!
> Leo.
>


---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

Nicolas Schwartz
Hi,

We are facing the same problem.
Sometimes the parameters don't get to tomcat.

We've seen this by monitoring our plateform through a servlet simply returning the value of a parameter.

We are also using apache+tomcat
apache-2.0.54
jakarta-tomcat-5.5.9

It occurs on GET requests, maybe on POST ones but we don't know.
The value of the parameter is not long, neither is the value.
It appears to occur "randomly"

Hope this will help to find a solution to the problem ...

--
Nicolas Schwartz


Pid a écrit :

> (i can't see a previous thread for this, new mail setup, so apologies if
> I'm restating.)
>
>
> Are you using GET or POST?
> And how many parameters are you submitting?
> And are there any particularly long bits of data in the parameters?
>
>
>
> lmelendez wrote:
>> Hi Rache,
>>
>> Well, we are seeing the problem. Our web application seems to *drop*
>> parameters for some requests and we still don't know what it is. We have
>> enabled Valves and Filters and it looks like the parameters never make
>> it to
>> tomcat.
>> The problem is intermitent and we cannot reproduce it at will. The same
>> request might work sometimes and show the problem in others and we were
>> really surprised that nobody else was having similar issues.
>>
>> We are currently using Apache 2.0.55 and Tomcat 5.0.28.
>> I am wondering if you have more information about this.
>>
>> Thanks!
>> Leo.
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: [hidden email]
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

Lou Caudell
In reply to this post by rache
rache wrote:

> Parameter values are set in the jsp either as hardcoded
> links(http://j.jsp?param=value) or as hidden parameters. When the program
> enters the doGet() or doPost() method of a servlet and check for the
> parameter, its null.
>
> String pvalue = req.getParameter("param");
>
> This happens intermittently. Is there any explanation on this. Is this a bug
> on Tomcat or somethings wrong with my code?
>
> Any help would be great!
> Thanks!
>  
I have noticed when debugging my loop, to assign actions, will cycle
more times than there are variables. Have you looked at the entire
request buffer with your debugger?

 Enumeration e = request.getParameterNames();
 while (e.hasMoreElements())
 {
   String s = (String)e.nextElement();    
   if (s.equals(A_BUTTON))  {action = A; break;}
   else if (s.equals(B_BUTTON))  {action = B; break;}
  }

- Lou Caudell

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

lmelendez
In reply to this post by Nicolas Schwartz
Nicolas Schwartz wrote
It occurs on GET requests, maybe on POST ones but we don't know.
The value of the parameter is not long, neither is the value.
It appears to occur "randomly"
Exact same thing in our case. We have seen it in GET requests, not entirely sure about POSTs. We use some URLs that are quite long (more than 255 characters), but we have seen the problem with URLs with four or five parameters only.

I'll check to see if we have long bits of data in the parameters. Do you think that is related?

We are a bit confused because we started seeing the problem only about a month ago. We checked all changes we did to the product and none of them seem to be causing the issue.

Thanks for the help!
Leo.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

Nicolas Schwartz
I thought it might come from the connector ...
Did you already try to change it ?
Which version are you using ?

Nicolas

lmelendez a écrit :

>
> Nicolas Schwartz wrote:
>> It occurs on GET requests, maybe on POST ones but we don't know.
>> The value of the parameter is not long, neither is the value.
>> It appears to occur "randomly"
>>
>
> Exact same thing in our case. We have seen it in GET requests, not entirely
> sure about POSTs. We use some URLs that are quite long (more than 255
> characters), but we have seen the problem with URLs with four or five
> parameters only.
>
> I'll check to see if we have long bits of data in the parameters. Do you
> think that is related?
>
> We are a bit confused because we started seeing the problem only about a
> month ago. We checked all changes we did to the product and none of them
> seem to be causing the issue.
>
> Thanks for the help!
> Leo.
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

lmelendez
Nicolas Schwartz wrote
I thought it might come from the connector ...
Did you already try to change it ?
Which version are you using ?
Interesting point Nicolas, to be honest with you... I don't know a lot about connectors. I went to the Server.xml file in Tomcat and found the following lines:

    <Connector port="8009"
               redirectPort="8443" debug="0"
               protocol="AJP/1.3" tomcatAuthentication="false"/>

All the other connectors are commented out. When you ask what connector am I using, where can I find that out?

Thanks!

Leo.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

lmelendez
in mod_jk.conf for apache, we have the following lines:

  # define the channel
  JkSet channel.socket:localhost:8009.port 8009
  JkSet channel.socket:localhost:8009.host 127.0.0.1

  # define the worker
  JkSet ajp13:localhost:8009.channel channel.socket:localhost:8009

  <Location "/console">
     JkUriSet group ajp13:localhost:8009
  </Location>

I'll do some research on how to change the connector and test it to see if there is a change.

Leo.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

Nicolas Schwartz
Hi !

Here is the configuration we have:

In our server.xml:
<Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
   port="7547"
   maxSpareThreads="75"
   minSpareThreads="40"
   maxThreads="500"
   enableLookups="false"
   acceptCount="100"
   tomcatAuthentication="false"
   protocol="AJP/1.3"
/>

##############################

In our workers.properties:

#parametrage de mod_jk

workers.apache_log=/usr/local/apache/logs
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java
ps=/

worker.list=ajp13

worker.ajp13.type=ajp13
worker.ajp13.host=81.91.65.146
worker.ajp13.port=7547
worker.ajp13.lbfactor=50
worker.ajp13.cachesize=350
worker.ajp13.cache_timeout=600
worker.ajp13.socket_keepalive=0
worker.ajp13.socket_timeout=600

################################

In our httpd.conf:

JkMount /serv/* ajp13

################################

I don't know which version of mod_jk we're using ... I'm looking into it.

Nicolas

lmelendez a écrit :

> in mod_jk.conf for apache, we have the following lines:
>
>   # define the channel
>   JkSet channel.socket:localhost:8009.port 8009
>   JkSet channel.socket:localhost:8009.host 127.0.0.1
>
>   # define the worker
>   JkSet ajp13:localhost:8009.channel channel.socket:localhost:8009
>
>   <Location "/console">
>      JkUriSet group ajp13:localhost:8009
>   </Location>
>
> I'll do some research on how to change the connector and test it to see if
> there is a change.
>
> Leo.
>


---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

Yashwanth CP
Hi,
We are facing a similar issue ( missing parameters intermittently ). Our
setup has relatively huge post requests , ( < 4KB) , and about 100-200
parallel connections on a tomcat that has 512MB memory.Some of the
parameters just become null randomly. Our guess is ,it is related to size of
post requests and number of accept connections. Any clues, anyone?

--y

On 8/18/06, Nicolas Schwartz <[hidden email]> wrote:

>
> Hi !
>
> Here is the configuration we have:
>
> In our server.xml:
> <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
>    port="7547"
>    maxSpareThreads="75"
>    minSpareThreads="40"
>    maxThreads="500"
>    enableLookups="false"
>    acceptCount="100"
>    tomcatAuthentication="false"
>    protocol="AJP/1.3"
> />
>
> ##############################
>
> In our workers.properties:
>
> #parametrage de mod_jk
>
> workers.apache_log=/usr/local/apache/logs
> workers.tomcat_home=/usr/local/tomcat
> workers.java_home=/usr/local/java
> ps=/
>
> worker.list=ajp13
>
> worker.ajp13.type=ajp13
> worker.ajp13.host=81.91.65.146
> worker.ajp13.port=7547
> worker.ajp13.lbfactor=50
> worker.ajp13.cachesize=350
> worker.ajp13.cache_timeout=600
> worker.ajp13.socket_keepalive=0
> worker.ajp13.socket_timeout=600
>
> ################################
>
> In our httpd.conf:
>
> JkMount /serv/* ajp13
>
> ################################
>
> I don't know which version of mod_jk we're using ... I'm looking into it.
>
> Nicolas
>
> lmelendez a écrit :
> > in mod_jk.conf for apache, we have the following lines:
> >
> >   # define the channel
> >   JkSet channel.socket:localhost:8009.port 8009
> >   JkSet channel.socket:localhost:8009.host 127.0.0.1
> >
> >   # define the worker
> >   JkSet ajp13:localhost:8009.channel channel.socket:localhost:8009
> >
> >   <Location "/console">
> >      JkUriSet group ajp13:localhost:8009
> >   </Location>
> >
> > I'll do some research on how to change the connector and test it to see
> if
> > there is a change.
> >
> > Leo.
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: [hidden email]
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
yashwanth cp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing Request Parameters

Nicolas Schwartz
As I said it happens even on GET requests and very small urls on our side.
Since it is a get request, we do see the parameter in the apache log, but we can't get it with the getParameter() method.

The parameter is lost somewhere between the connector and tomcat I think.

Nicolas

Yashwanth CP a écrit :

> Hi,
> We are facing a similar issue ( missing parameters intermittently ). Our
> setup has relatively huge post requests , ( < 4KB) , and about 100-200
> parallel connections on a tomcat that has 512MB memory.Some of the
> parameters just become null randomly. Our guess is ,it is related to
> size of
> post requests and number of accept connections. Any clues, anyone?
>
> --y
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

12
Loading...