Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpSessionBindingListener valueBound not being called

 
Howard Ralstone
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure your logger works??

Try just to write something to the console.
 
Howard Ralstone
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic