tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: session.getSessionContext();
Date Thu, 16 Nov 2000 02:56:21 GMT
David Molloy wrote:

> Hi,
>         I'm trying to write a simple Snoop servlet for my system
> and have run into a small problem while porting from JServ to Tomcat.
> I have sessions working for authentication etc. - however when I use
> HttpSessionContext context = session.getSessionContext();
> System.err.println("Context = " + context);
> System.err.println("Enumeration = " + context.getIds());
> System.err.println("NextElement = " + context.getIds().nextElement());
> The Enumeration doesn't give an error but it doesn't fill up, despite
> the fact that there is definately a session open (you need to be
> logged in to use the snoop servlet).  For some reason the context
> doesn't seem to have any Ids, and hence the next line gives a
> java.util.NoSuchElementException: VectorEnumerator
> I've been looking for docs on any changes in session but didn't
> find any.  Any ideas would be greatly appreciated...thanks.
> Dave Molloy

See the Servlet 2.2 specification at
<>, and the
corresponding servlet API Javadocs.  You will find that the
getSessionContext() method has been deprecated, and returns an "empty"
session context.  Likewise, the ServletContext.getServlet() method has
been deprecated, and always returns null.  These tend to be the two
largest issues when porting applications based on the servlet 2.0 API (as
Apache JServ is).

Craig McClanahan

View raw message