title: How to manually kill a specific HttpSession by ID
body: <p>We need a functionality of killing a specific session (by session ID) from some kind of an admin panel. </p>
  
  <p>I attempted using the following approach:</p>
  
  <pre><code>public static void killSession(String sid) {
  
      HttpSessionContext sc = FacesUtil.getSession().getSessionContext();
      HttpSession session=sc.getSession(sid);        
  
      session.invalidate();
  }
  </code></pre>
  
  <p>However </p>
  
  <ol>
  <li>HttpSessionContext, and getSessionContext() and
  getSession(sessionId) methods of a session are all deprecated (for seemingly paranoid security reasons)</li>
  <li>The above code also gets a null session when invoked in an ApplicationScoped JSF managed bean</li>
  </ol>
  
  <p>I'm seeking an alternative way of achieving the functionality.</p>