I posted a request for assistance earlier with this error, where the
Context in the Catalina connector was becoming null. I found a couple of
other messages posted where others had encountered a similar problem, so
I thought I would post a quick explanation of what I was doing that was
causing the error:

I created a class that stored the Request object, and stored that class
in the session.

class Desktop {
protected HttpServletRequest request;
protected Desktop(HttpServletRequest request) {
this.request = request;

public static Desktop getDesktop(HttpServletRequest request) {
Desktop desktop = (Desktop)
if (desktop==null) return new Desktop(request);
// Fix goes here (see later)
return desktop;

public void setAttribute(String name, String value) {
request.setAttribute(name, value);

Now, of course this will work as long as the cached request object is
valid - but that is really up to the web server. I'm not working with
the current request object, but with the one that was cached in the
session when the Desktop was created. And at some point that won't work,
though the error appears sporadically because the Context object in the
Request only goes out of scope at the discretion of the server (I have
no idea how that is determined).

The fix goes in the marked line above:
desktop.request = request;

And it works fine. Stupid error on my part, but a monster to locate. I
hope someone finds this explanation useful ;-)

All the best,

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupissues @
postedNov 29, '06 at 7:37p
activeNov 29, '06 at 7:37p

1 user in discussion

Craig Mason-Jones: 1 post



site design / logo © 2021 Grokbase