tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Treitlinger <ttreitlin...@gmail.com>
Subject Re: Tomcat 5.5.23 request.getAttribute("foo") returns unexpected NULL
Date Fri, 13 Aug 2010 12:23:43 GMT
Hi Chris,

thanks for your reply. Using your code, I get the same output, and
unable to print the value using <c:out>, but that's not what I'm
trying to do.

Most of the time this application works as intended, here is some more detail:

* The JSPs are dumb landing pages - only used to track which URL was requested.
* The foo value is set on the landing JSP, then the request is
forwarded to a servlet.
* The servlet gets a lot of work done.
* The servlet then creates a response. This is formatted as XML or otherwise.
* To determine the required format, it checks the foo value set by the
landing JSP.

Here is one of the landing JSPs:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="foo" scope="request" >XML</c:set>
<jsp:forward page="/request.go" />

This invokes a servlet which has the following code in its doGet():

// get foo value from request
String fooValue = (String) request.getAttribute("foo");

//...

It's at this point that the servlet suddenly got NULL back from getAttribute().
I have checked for any code that could remove the attribute or set it
to null and there doesn't seem to be any in the application.

To me this looks like some kind of Tomcat failure:
* the incoming HttpServletRequest object has somehow 'lost' the
attribute set earlier
* it's not our application code that makes the attribute disappear
* maybe the attribute is never actually set on the HttpServletRequest?

As I said, this was running for weeks with no issues and no unusual
load, then suddenly every request showed this failure.
Even after Tomcat was restarted, the issue continued.

At this stage we're just trying to establish what exactly happened.

Regards,
Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message