[Echo-list] Trying to access ServerContext keeps throwing NPE
Brought to you by:
tliebeck
From: Thomas H. L. <th...@tr...> - 2004-05-15 22:25:35
|
I've tried posting this on the forums, but no reply. So trying here. Sorry for the double posting, but I cant get further in my development without this solved. I'm running Echo 1.0.3 on JBoss 3.2.3/Tomcat and the echo app is protected correctly with login to the backend container. I am now trying to access the server context in the echo application to print the username of the person logged in, but whenever I try to access the server context it keeps throwing me an NPE. ServerContext serverCtx = (ServerContext)(getEchoInstance().getAttribute(ServerContext.ATTRIBUTE_NAME)); System.err.println("Logged in name:" + serverCtx.getUserPrincipal().getName()); Can anyone give me any hints on what might be wrong? Is the server context available "all the time"? Do I need to put the code somewhere special? I've tried looking through the maillist archives, forums and API docs, but I am just simply stuck. Please help - thanks! /Thomas |