• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Servlet parameters disappearing  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a strange problem regarding my web app. Basically there are a couple of functionalities where I submit a form with GET or POST and sometimes (not always, no pattern found, just submitting a form after calling some js) I don't get the parameters sent at the server. I put a sniffer and checked that the parameters always leave the browser. Then I have a System.out.println at my first filter (in doFilter) of request.getParameterMap.keySet() and when the problem occurs the println shows empty parameters ([]). Somehow the parameters disappear. This happens with the application running on a Tomcat 5.0.28 and also on a Websphere 5. The only clue that I have is that the Velocity pages with the forms where this happens has also previous calls to serverside methods via JSon-RPC. I see the JSon-RPC calls on the sniffer, but I cannot seem to connect them with the problem since there's no exception or error coming from json and since json runs in a different servlet. I really need help on this, any ideas?

Thanks,
Federico
 
Ranch Hand
Posts: 2081
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to debug it, you can compare the code that works versus the code that doesnt work. you might some clue there.

as you mentioned, that it worked some times
 
Federico Pugnali
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean sometimes with the same code (!).
Anyway I've found the problem. I'll try to explain it. The object registered for the JSon-RPC bridge was an inner class. The method accessed via JSon in this inner class then calls a method in its outter class. The outter class has a reference to the last HttpServletRequest. When thru the JSon call any code does a request.getParameter("anything"), although the logic goes ok, the next submit SOMETIMES looses its parameters. I reproduced the bug just with one line (the getparameter one). The failure seems to happen 1 out of 5 or 6 times. When I commented the request.getparameter lines (that has no sense in the JSon calls anyway) the problem didn't appear anymore. So one IF (if(JSonCall)) did the workaround. I still don't know if it's a JSon-RPC-Java bug. I hope my issue helps.

Federico
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for posting back.
Sounds like a hell of a problem to debug.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!