File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sessionDestroyed works, but not sessionCreated

 
Stephen Huey
Ranch Hand
Posts: 618
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any idea why my stdout.log in Tomcat would be recording print statements from sessionDestroyed but not sessionCreated?




This has been frustrating me for a while. I thought it simply wasn't listening, but apparently it is since I do get statements beginning with "Removed session" in the log file!
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Karelicek Huey:

UserAcctBean user = (UserAcctBean) session.getAttribute("currentuser");
String loginID = user.getLoginID();


Just a wild guess, but maybe currentuser attribute is not set yet,because the session has just been created.
So you are getting a null pointer exception when you call user.getLoginID.
You could try putting a try-catch block for NullPointer around that call, and see if this is the reason.
 
Stephen Huey
Ranch Hand
Posts: 618
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much!

So simple...I remember that thought crossing my mind when I was first typing that line, but I totally forgot that later on. Details, details...
:roll:


Two thumbs up for you, man! Next one's on me.
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No worries mate. As they say, two pairs of eyes are always better than one when hunting for bugs.
I was wondering though, whether it is a part of the specification that if an exception is thrown in one of these methods, the container must catch it and just continue.

cheers
Sonny
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic