History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: UP-1524
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Eric Dalquist
Reporter: Robert Young
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
uPortal

Classes implement HttpSessionBindingListener when they should implement HttpSessionListener.

Created: 01/Jun/06 11:20 AM   Updated: 05/Mar/08 07:51 AM
Component/s: None
Affects Version/s: 2.5.2 RC1
Fix Version/s: 3.0.0-RC2

Original Estimate: 4 hours Remaining Estimate: 4 hours Time Spent: Unknown


 Description  « Hide
See apache issue reported as a bug.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38242

and

http://issues.apache.org/bugzilla/show_bug.cgi?id=34107


Many classes implement HttpSessionBindingListener instead of HttpSessionListener. This causes a problem with Tomcat 5.5.12 when they try and unbind values from the session, but the call to getSessionId returns null, and throws an invalidStateException. The spec. states that the HttpSessionBindingListener "causes an object to be notified when it is bound to[,] or unbound from a session." The HttpSessionListener spec states, "implementations of this interface are notified of changes to the list of active sessions in a web application."

UPortal is wanting to unbind values when the session is destroyed, therefore it should implement the HttpSessionListener, not the HttpSessionBindingListener. There is no guarantee that all portal containers will implement this correctly and have a valid session once session.invalidate() has been called.

This worked fine in earlier Tomcat versions, however the current implementation is not correct. All classes that implement HttpSessionBindingListener need to be changed to implement HttpSessionListener, and all methods that receive a HttpSessionBindingEvent need to be changed to receive a HttpSessionEvent.

Classes effected:
org.jasig.portal.GuestUserInstance
org.jasig.portal.GuestUserPreferencesManager
org.jasig.portal.GuestUserPreferencesManagerWrapper
org.jasig.portal.IUserPreferencesManager
org.jasig.portal.UserInstance
org.jasig.portal.UserInstanceManager
org.jasig.portal.UserPreferencesManager
org.jasig.portal.jndi.JNDIManager

Example Fix:

Current Version:

public class UserInstance implements HttpSessionBindingListener
{
    public void valueUnbound(HttpSessionBindingEvent bindingEvent)
    {
    }

    public void valueBound (HttpSessionBindingEvent bindingEvent)
    {
    }
}

public class GuestUserPreferencesManager extends UserPreferencesManager
{
    public void finishedSession(HttpSessionBindingEvent bindingEvent, String sessionId)
    {
    }
}

Fix version:

public class UserInstance implements HttpSessionListener
{
    public void sessionDestroyed(HttpSessionEvent bindingEvent)
    {
    }

     public void sessionCreated (HttpSessionEvent bindingEvent)
    {
    }
}

public class GuestUserPreferencesManager extends UserPreferencesManager
{
    public void finishedSession(HttpSessionEvent bindingEvent, String sessionId)
    {
    }





 All   Comments   Work Log   Change History      Sort Order:
Parker Grimes [28/Sep/07 11:43 AM]
What is the status of this issue? I am experiencing it in uPortal 2.6.0 GA and 2.6.1 RC1

This doesn't seem to cause any bad behavior in uPortal, it is just annoying. I get the following error in my logs a lot:

ERROR [ContainerBackgroundProcessor[StandardEngine[Catalina]]] portlet.CPortletAdapter.[] Sep/28 08:29:50 - java.lang.IllegalStateException: invalidate: Session already invalidate
d
java.lang.IllegalStateException: invalidate: Session already invalidated
at org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1096)
at org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:150)
at org.apache.pluto.core.impl.PortletSessionImpl.invalidate(PortletSessionImpl.java:81)
at org.jasig.portal.channels.portlet.CPortletAdapter.receiveEvent(CPortletAdapter.java:367)
at org.jasig.portal.ChannelManager.finishedSession(ChannelManager.java:289)
at org.jasig.portal.UserInstance.valueUnbound(UserInstance.java:749)
at org.jasig.portal.UserInstanceManager$UserInstanceHolder.valueUnbound(UserInstanceManager.java:134)
at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1625)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:749)
at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:581)
at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:679)
at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:664)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1285)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
at java.lang.Thread.run(Thread.java:595)


Eric Dalquist [10/Jan/08 04:52 PM]
This change will be made for uPortal 3 RC2

Eric Dalquist [17/Jan/08 05:45 PM]
The uPortal classes that implement HttpSessionBindingListener are:
JNDIManager
UserInstanceHolder
UserInstance
GuestUserInstance

The change is a bit more complex as a HttpSessionListener must be registered in the web.xml versus a HttpSessionBindingListener which gets events just by being in the HttpSession.


Eric Dalquist [23/Jan/08 03:18 PM]
This has been fixed in 3.0