Exception on sessionDestroyed when calling another beans method
<p>I am facing problem when i am calling database insert method under </p>

<pre><code>public void sessionDestroyed(HttpSessionEvent se)
</code></pre>

<p>sessionDestroyed threw exception of  </p>

<pre><code>Session event listener threw exception java.lang.NullPointerException
</code></pre>

<p>my complete code looks like </p>

<pre><code>public void sessionDestroyed(HttpSessionEvent se) 
{
UserInfo currentUser = new UserInfo();
    AccessHistory loginHist = new AccessHistory();
    HttpSession session = se.getSession();

    if (session != null) {
        if (session.getAttribute("userInfo") != null) {
            currentUser = (UserInfo) session.getAttribute "userInfo");
            if (currentUser.getUserId() != null )                   
            {
                if(!currentUser.getUserId().isEmpty()){

                loginHist.setUserId(currentUser.getUserId());
                try {
                    getAccessHistoryDAO().maintHistory(loginHist, false);

                } catch (DAOException e) {

                    e.printStackTrace();
                }
                }
            }
        }

    }
</code></pre>

<p>any help will be greatly appricated. thank you.</p>
