>>- Forward to page /account and read the HttpSession (not working)

Does your /account url map to a different context or a different
servlet?

Maybe having two context or 2 servlets causes your problem.

For my app, I use just one service Implementation class, and that
service may call other helper classes that provide various system
functionality.  So everything is in one Servlet.

Mike.

On Sep 20, 10:24 pm, Dariusz <[email protected]> wrote:
> Hi!
>
> A simple scenario.
>
> - User logs in
> - User in database, save user object in HttpSession (works)
> - Forward to page /account and read the HttpSession (not working)
>
> Saving the user object in session works fine, but when I try to read
> it, I get a "NullPointerException". The session is not there.
>
> The weird part is here. If I run it on my local machine (http://
> localhost:8080/myApp) it's working fine and I can set and read the
> session through my entire application. If I deploy it on our server
> (Linux), I can set the session and read it with the same Impl class,
> but if I try to execute a different service (like AccountServiceImpl),
> then the session is not there anymore.
>
> My code looks like this:
> ...
> HttpServletRequest request = this.getThreadLocalRequest();
> HttpSession session = request.getSession();
> session.setAttribute( "user", userObject );
>
> User u = ( User )session.getAttribute( "user" );
> // here it is working
> System.out.println( "User name is: " +u.getName() );
>
> Now if I try to get the session in my AccountServiceImpl, I'm getting
> an exception???
>
> I'm wondering if it's a server setting issue or something with my
> code? (or maybe with my libraries)
>
> I would appreciate any help!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to