• 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

HttpSessionListener does NOT work in WAS 6.0

 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

I found one unexpected scenario in which a HttpSessionListener does NOT seem to work in WAS 6.0. Actually the code which is supposed to do the operation when the session is destroyed is not working.

When trying to debug by placing some SOP's also not getting invoked. That way it looks like the the listener is NOT invoked when the session is getting destroyed.

Has any one faced this scenario before or any other suggestions for this?

Thanks in advance!
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there anyone who can help me out?
 
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you ever successfully done this on a different application server? I just want to make sure its a WAS thing and not a coding issue. If it IS WAS screwing up then I would call IBM software support.
 
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can you please post the code and web.xml to have a look at ?
Also when do you expect the session is getting destroyed?
May be you can try the same code only for HttpSessionListener on Tomcat and check if it works correctly.

Regards,
Amit
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bryce Martin:
Have you ever successfully done this on a different application server? I just want to make sure its a WAS thing and not a coding issue. If it IS WAS screwing up then I would call IBM software support.



Hi Bryce,

Thank you. Yes, i have done the same in Tomcat (in Netbeans IDE). It works so perfectly.

Perhaps i also would have done the same but prior to that just wanted to check it up with ranchers here.
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by amit punekar:
Hi,
Can you please post the code and web.xml to have a look at ?



Thank you Amit..

Here you go


<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"<br /> xmlns="http://java.sun.com/xml/ns/j2ee"<br /> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br /> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee " target="_blank" rel="nofollow">http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">;
<display-name>MySQLTestWebProject</display-name>
<listener>
<description>
HttpSessionListener for SessionInvalidate test
</description>
<display-name>LMRASessionListener</display-name>
<listener-class>
test.servlet.listener.session.invalidate.LMRASessionListener
</listener-class>
</listener>
<servlet>
<description></description>
<display-name>MyServlet</display-name>
<servlet-name>MyServlet</servlet-name>
<servlet-class>
test.servlet.listener.session.invalidate.MyServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/MyServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<resource-ref id="MySQLResourceRef">
<description>
</description>
<res-ref-name>jdbc/mysqldsref</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>



Note: As the web.xml elements are not getting displayed corrected if i use Code Tags, i used Quote tags here!


Also when do you expect the session is getting destroyed?



Is it when or what? I think it should have been intended for 'what'. I do expect an database call to be invoked (say a lock on an user has to be released when the session gets destroyed). [The lock is obtained on the sessioncreated for the logged in user).


May be you can try the same code only for HttpSessionListener on Tomcat and check if it works correctly.



Yes i did check the same in Tomcat (inside Netbeans IDE) and it works so perfectly! But NOT in WAS!

[Edited because all tags/elements in web.xml were not getting displayed ]

[ January 24, 2008: Message edited by: Raghavan Muthu ]
[ January 24, 2008: Message edited by: Raghavan Muthu ]
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic