• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HttpSessionBindingListener valueBound not being called

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure your logger works??

Try just to write something to the console.
 
Howard Ralstone
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic