File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes HttpSessionBindingListener valueBound not being called Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpSessionBindingListener valueBound not being called" Watch "HttpSessionBindingListener valueBound not being called" New topic
Author

HttpSessionBindingListener valueBound not being called

Howard Ralstone
Greenhorn

Joined: Nov 21, 2004
Posts: 8
Hello All,

Using RAD 7.5 with WAS6.1. Struts 1.2 with JDK 1.4

I have a class that implements HttpSessionBindingListener and Serializable. When I create an object of that class I get my debug statement in the constructor. However, when I add the object to the HttpSession, I don't see that valueBound ever get called. When I logout and invalidate the session I don't see valueUnbound get called either.

Could this be a Websphere issue? I haven't found anything on Google that would invalidate the code below.

Thanks!

Howard



Usage in my action:

Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Are you sure your logger works??

Try just to write something to the console.


JDBCSupport - An easy to use, light-weight JDBC framework -
Howard Ralstone
Greenhorn

Joined: Nov 21, 2004
Posts: 8
Hello,

Yes, the logger seems to be okay. I do see the output from the constructor. I added System.out.println statements to the constructor and both methods. Again, all I see is output from the constructor.

Thanks,

Howard
Howard Ralstone
Greenhorn

Joined: Nov 21, 2004
Posts: 8
Okay, I found the issue. I've been with the company for a couple of weeks. It turns out that the call to request.getSession() doesn't bring back a straight up HttpSession object. It returns an object from a custom class that overrides HttpSession. In turn, when you set or get an attribute, it checks permissions for that attribute name. So when I set the attribute and it wasn't in the xml file as an acceptable attribute, it instead added it to a cache. In return, when I call getAttribute I got the object back out of the cache.

Once I added my attribute name and class to the persistence policy xml file it worked as expected.

Too bad I wasted most of the day finding out that little detail
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpSessionBindingListener valueBound not being called
 
Similar Threads
why why HttpSessionBindingListener method didn't trigger?
HttpSessionBindingListener
HttpSessionBindingListener
is this a bug?
HttpSessionListener