Anyone else having a problem with a session bean becoming null??

Discussions

EJB programming & troubleshooting: Anyone else having a problem with a session bean becoming null??

  1. We store an OrderEntry bean in the session. The weblogic.httpd.session.timeoutSecs is set to 3600, which is plenty. But, every so often, if you 'sit' on a page for like 3-5 minutes, and then you go to another page that then tries to pull the session bean from the session object, it comes back as null.

    Has anyone else had a problem with this? This is, of course, a stateful session bean. I've also grabbed the session.getMaxInactiveInterval and it's very high as well.

    Thanks
  2. I assume that the bean is a Stateful Session EJB.

    The life cycle for the stateful session EJB is not directly related with the HttpSession timeout that u had mentioned. The timeout period of the EJB is specified at the time of deployment in the Deployment Descriptor. Please have a look at the timeout period on the EJB DD. If u hadn't specified any value, check the default timeout period on your EJB container. Normally the timeout period is 10 sec, thats why you see that stateful session bean is timed out and invalidated.



  3. Another reason for not getting the stateful session bean stub from the HttpSession could be, that you have an insufficient session handling in the web container. This means that normally session handling is managed with cookies, but if the client denies to accept cookies, the session is lost. Here you have to use the "encodeUrl" syntax for maintaining the session between navigating.

    Best regards
    Michael
  4. That's not the case here..
  5. What is the deployment description tag? Her'es a copy of the xml descriptor file:

    <?xml version="1.0"?>

    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>

    <weblogic-ejb-jar>
        <weblogic-enterprise-bean>
          <ejb-name>S_OrderEntry</ejb-name>
          <caching-descriptor>
    <max-beans-in-cache>250</max-beans-in-cache>
            <idle-timeout-seconds>900</idle-timeout-seconds>
          </caching-descriptor>
          <transaction-descriptor>
    <trans-timeout-seconds>900</trans-timeout-seconds>
          </transaction-descriptor>
          <jndi-name>S_OrderEntry.S_OrderEntryHome</jndi-name>
        </weblogic-enterprise-bean>
      </weblogic-ejb-jar>

    "idle-timeout-seconds" is a new tag I added yesterday trying to combat this issue.

    Thanks!