This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes HttpSessionListener  is not getting invoked Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpSessionListener  is not getting invoked " Watch "HttpSessionListener  is not getting invoked " New topic
Author

HttpSessionListener is not getting invoked

MATHEW ALEX
Greenhorn

Joined: Feb 12, 2008
Posts: 2
Hi,


I am supporting a j2EE application
The main components in the application is

Java 1.4
Struts 1.2.7
Weblogic 8.1 sp 4
Oracle 10 G


Problem

The sessionDestroyed method of HttpSessionListener class which is implemented by Local class is not getting invoked.

It is not happening frequently, it is happening for some of the user in the application once in a blue moon




In the application, when a user login into the application the execute method of Action is storing the Session set Maxinactive Interval as the following as




HttpSession hs = httpRequest.getSession(true);
String expireTime = ConfigProperties.getConfigValues(SESSION_EXPIRE_TIME);
int iexpireTime = Integer.parseInt(expireTime);
hs.setMaxInactiveInterval(iexpireTime);


So when the User login the expire Time is stored in Http Session

The Application´┐Żs Listener class code is the following one




public class SessionListener implements HttpSessionListener {


public void sessionCreated(HttpSessionEvent event) {



}

public void sessionDestroyed(HttpSessionEvent event) {
String METHOD_NAME = "sessionDestroyed";
LogoutBusiness logoutBusiness = new LogoutBusiness();

HttpSession hs = event.getSession();
Session session = (Session)hs.getAttribute(GlobalConstants.SESSION);
if(session != null){
UserProfile userProfile = session.getProfile();
try{
if(userProfile != null){
String LoginID = userProfile.getLoginID();
logoutBusiness.processLogout(LoginID);
session.setProfile(null);
hs.setAttribute(GlobalConstants.SESSION,null);
}
}catch(Exception e){
NokiaLogger.writeException(CLASS_NAME,METHOD_NAME,e);
}
}
}
}



And the entries in web.xml file is the following one



Web .xml Entries


<web-app>
<display-name>APPLICATION NAME</display-name>
<listener>
<listener-class>
SessionListener
</listener-class>
</listener>


<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>

<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>




<servlet >
<servlet-name>StartUpServlet</servlet-name>
<display-name>StartUpServlet</display-name>
<servlet-class> common.utils. StartUpServletJAVA</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>200</session-timeout>
</session-config>




So can body help out to find the root cause of the issue

[ February 13, 2008: Message edited by: MATHEW ALEX ]
[ February 13, 2008: Message edited by: MATHEW ALEX ]

GIBY ALEX
Kumar Garlapati
Ranch Hand

Joined: Feb 04, 2008
Posts: 38
please past the code in UBB format, please just dump the code like that.


Regards,<br />Kumar
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: HttpSessionListener is not getting invoked