1 Reply Latest reply on Nov 28, 2012 2:34 PM by PHCharbonneau

    MemorySessionData returned instead of custom session object when 404 error

      WebLogic Server Version:
      weblogic.servlet.internal.session.MemorySessionData returned instead of our custom session object when 404 error comes. How can I ensure that custom session object is returned?

      We have implemented HttpSession in our application com.web.failover.ReplicatedSession implements HttpSession, Serializable.
      We store attrbites as "AttributeWrapper implements Externalizable" in com.web.failover.ReplicatedSession

      This session is used in all the places in our app.
      When we call, HttpSession session = request.getSession(false);
      It returns an object of type: com.web.failover.ReplicatedSession

      Except for one place 'VirtualLinkHandler' where it returns weblogic.servlet.internal.session.MemorySessionData.
      This servlet is called when 404 error occurs in our app.
      This results in ClassCast Exception when we try to get any attribute value in this servlet.

      Please note that session ID is same in all the cases. I checked in the filters as well before the request reaches 'VirtualLinkHandler' and
      the session object is always of type com.web.failover.ReplicatedSession

      These are the settings:


      Code Flow:
      Connect.java sends a response.sendRedirect("/abc/Administrator/test.doc") where /abc is the context-path of my application
      This results in 404 and the request goes to VirtualLinkHandler service() method.

      java.lang.ClassCastException: com.web.failover.AttributeWrapper cannot be cast to java.lang.String
           at com.web.virtuallink.VirtualLinkHandler.service(VirtualLinkHandler.java:80)
           at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
           at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)

      In connect.java Session is com.web.failover.ReplicatedSession@38a5b7
      In connect.java Session ID 4Q5mQ1tfC3fBn2pRJh1YFbl2G99xQtPjhWZzDHq6YdTLNY14DxRG!331366247!1354083839188
      FILTER Session is com.web.failover.ReplicatedSession@38a5b7
      VirtualLinkHandler Session weblogic.servlet.internal.session.MemorySessionData@1256ca7
      VirtualLinkHandler Session ID 4Q5mQ1tfC3fBn2pRJh1YFbl2G99xQtPjhWZzDHq6YdTLNY14DxRG!331366247!1354083839188

      Edited by: 848852 on Nov 27, 2012 11:53 PM
        • 1. Re: MemorySessionData returned instead of custom session object when 404 error

          I have seen a lot of problems with client implementations attempting to override the HttpSession object with a custom implementation.

          weblogic.servlet.internal.session.MemorySessionData is the inner & default Weblogic HttpSession implementation class so it looks like, as you mentioned, that your override method is not working for this particular Servlet.

          At this point my recommendation is for you to create an SR with Oracle, share your code & configuration so they can determine if Weblogic 12 is fully supporting what you are trying to achieve.