cancel
Showing results for 
Search instead for 
Did you mean: 

Killsession App for SAP BO XI and TOMCAT7

Former Member
0 Kudos

Hi everyone,

Since the utilization of Tomcat7 with BO XI 3.1 SP6, the application Killsession.jar can't works.

I've found a .jsp app which killed ALL the sessions, but it's not what I want.

I really want the same function than Killsession. I want to be able to eliminate the session that I want, not ALL.

Help me please !

Regards

PLMaurin

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos
Former Member
0 Kudos

I'm also having trouble getting KillSession to work on 3.1 SP7 - I followed 1886165 but the instructions are old so probably don't take into account Tomcat 7.

The instructions for 4.0/4.1 in that note do not help as they refer to completely different folder structure

Can anyone help?

Former Member
0 Kudos

Hi,

Please see the SAP note 1886165. There is a zip file attached in the note as well as a brief on how to install.

The note talks about Tomcat6 but i suppose it should be the same for version 7.

Regards,

Tunwiir

Former Member
0 Kudos

Download the version from the SCN post and then add the XI 3.1 jars to the
WEB-INF/lib directory and deploy it

http://scn.sap.com/message/14034811#14034811

then

link to the version XI 3.1 jars to the WEB-INF/lib

http://scn.sap.com/servlet/JiveServlet/download/14034811-127236/KillSession.txt.zip

I believe this should resolve your issue.

zhang_jiwen
Participant
0 Kudos

Hi MAURIN ,

      Please refer to the below codes,hope it can help you.

      There are two jsp pages:

       1.LogonForm.jsp:

<%!
/*
* Creation Date: August 25, 2011
* Description:  This logon form is used to gather the logon information that is needed
*      to login to Enterprise as well as to gather the name of the user whose
*     active sessions are to be terminated.
* Author:   RT
*/
private class LogonForm {

// Store the request and response objects into class variables.
HttpServletRequest myRequest;
HttpServletResponse myResponse;

// Logon Information
String cmsName;
String userName;
String password;
String authType;

// The user name whose sessions are to be deleted.
String userNameToDeleteSessions;

/**************************************************************************
  *
  * Constructor - The constructor takes in the request and response objects.
  *     Save these to class variables.
  *              
  *************************************************************************/
LogonForm (HttpServletRequest request, HttpServletResponse response)
{
  this.myRequest = request;
  this.myResponse = response;
}

/**************************************************************************
  *
  * When this function is called by the caller, the request object will be
  * examined and a check will be made to see if it is necessary to display
  * the logon form to the user.  If the user has already entered information
  * onto the form, then set the class variables to values that are in the
  * request object.  If they haven't already entered information, then
  * display the form so that the user can enter the logon information.
  *
  * Return true if the logon form was displayed and false if it wasn't.
  *              
  *************************************************************************/
public boolean displayLogonForm() throws java.io.IOException
{
   // Check the request object to see if a logon request has already been
   // submitted by the user.  To check this, we will check to see if the
   // cmsName parameter has a value.  If it has a value, then we know
   // the form has already been filled in so we will read in the results
   // from the request object into the class variables.
  if (myRequest.getParameter("LogonForm.cmsName") == null)
  {
   // Display the logon form to the user so that they can enter the
   // logon information and submit it.
   // Then return control back to the caller.
  
   // Initialize the display form that will be displayed to the user.
   String displayForm = "";
  
   // Prepare the displayForm that will be displayed to the user.
   displayForm += "<HTML>\r\n";
  
   displayForm += " <HEAD><TITLE>Enter Logon Information</TITLE></HEAD>\r\n";
  
   displayForm += "  <BODY>\r\n";
  
   displayForm += "   <table>\r\n";
  
   displayForm += "    <form method=\"post\">\r\n";
  
   displayForm += "     <tr><td>Please enter your Enterprise Logon Information:</td></tr>\r\n";
  
   displayForm += "     <tr><td>CMS Name: </td><td><input type=\"text\" name=\"LogonForm.cmsName\"></td></tr>\r\n";
  
   displayForm += "            <tr><td>User Name: </td><td><input type=\"text\" name=\"LogonForm.userName\"></td></tr>\r\n";
  
   displayForm += "           <tr><td>Password: </td><td><input type=\"password\" name=\"LogonForm.password\"></td></tr>\r\n";
  
   displayForm += "           <tr><td>Authentication Type:</td>\r\n";
  
   displayForm += "        <td>\r\n";
  
   displayForm += "               <select name=\"LogonForm.authType\" size=1 width=250>\r\n";
  
   displayForm += "                 <option value=\"secEnterprise\">Enterprise\r\n";
  
   displayForm += "            <option value=\"secLDAP\">LDAP\r\n";
  
   displayForm += "               </select>\r\n";
  
   displayForm += "            </td>\r\n";
  
   displayForm += "           </tr>\r\n";
  
   displayForm += "           <tr></tr>\r\n";
  
   displayForm += "     <tr><td>Please enter the user name whose active sessions are to be terminated:</td></tr>\r\n";
  
   displayForm += "           <tr><td>User name: </td><td><input type=\"text\" name=\"LogonForm.userNameToDeleteSessions\"></td></tr>\r\n";
  
   displayForm += "           <tr></tr>\r\n";
  
   displayForm += "           <tr></tr>\r\n";
  
   displayForm += "           <tr><td/><td><input type=\"submit\" value=\"Submit_Form\"></td></tr>\r\n";  
  
   displayForm += "         </form>\r\n";
  
   displayForm += "        </table>\r\n";
  
   displayForm += "    </BODY>\r\n";
  
   displayForm += "</HTML>\r\n";
        
   myResponse.getWriter().print(displayForm);
  
   return true;
  }
  else
  {
   // The logon form has already been filled in.
   // Return control back to the caller.
  
   // Read in the results from the request object into the class variables.
   cmsName = myRequest.getParameter("LogonForm.cmsName");
   userName = myRequest.getParameter("LogonForm.userName");
   password = myRequest.getParameter("LogonForm.password");
   authType = myRequest.getParameter("LogonForm.authType");
   userNameToDeleteSessions = myRequest.getParameter("LogonForm.userNameToDeleteSessions");
  
   return false;
  }
}
}
%>

2.DeleteUserSessions.jsp

<%
/*
* Product:   Business Objects Enterprise XI 3.1
* Creation Date:  August 25, 2011
* Description:  This sample demonstrates how to to terminate all of a specified user's currently
*     active sessions.
*     The information to log on to the Enterprise along with the name
*     of the user whose active sessions are to be terminated are entered on the
*     logon form.
*/
%>

<%@ page import = "com.crystaldecisions.sdk.framework.*,
       com.crystaldecisions.sdk.occa.infostore.IInfoStore,
       com.crystaldecisions.sdk.occa.infostore.IInfoObject,
       com.crystaldecisions.sdk.occa.infostore.IInfoObjects,
       com.crystaldecisions.sdk.framework.IEnterpriseSession,
                   com.crystaldecisions.sdk.framework.CrystalEnterprise"
%>

<%@ include file = "LogonForm.jsp" %>

<%
// Declarations

// Declare the Logon Form object.  This form allows for the user to enter
// information that will allow them to logon to the Enterprise.
LogonForm myLogonForm = null;

// Business Object Declarations.
IEnterpriseSession boEnterpriseSession = null;
ISessionMgr boSessionMgr = null;
IInfoStore boInfoStore = null;
IInfoObjects boInfoObjects = null;
IInfoObject boInfoObject = null;

// Logon Information
String userName = null;
String cmsName = null;
String password = null;
String authType = null;

// Store the name of the user whose active sessions are to be terminated.
String userNameToDeleteSessions = null;

// Try block that will catch an Exception.
try
{
  // Instantiate a new LogonForm so that the information that is required
  // to log onto the Enterprise as well as the information related to the
  // calendar template can be gathered.
  myLogonForm = new LogonForm(request, response);
 
  // If logon information is required, then display the logon form.
  if (myLogonForm.displayLogonForm())
  {   
   // Return to the logon form so that it will be shown and the user
   // can enter the information.
   return;
  }
 
  // Get the logon Information
  userName = myLogonForm.userName;
  cmsName = myLogonForm.cmsName;
  password = myLogonForm.password;
  authType = myLogonForm.authType;
 
  // Get the name of the inbox entry.
  userNameToDeleteSessions = myLogonForm.userNameToDeleteSessions;
 
  // Initialize the Session Manager by getting it from the Crystal Enterprise
  // class's getSessionMgr function.
  boSessionMgr = CrystalEnterprise.getSessionMgr();
 
  // Logon to the Session Manager to create a new BOE session.  Pass in the
  // user name, password, the CMS name, and the authentication
  // type.
  boEnterpriseSession = boSessionMgr.logon(userName, password, cmsName, authType);
 
     //Retrieve the InfoStore object
     boInfoStore = (IInfoStore) boEnterpriseSession.getService("", "InfoStore");

  // Set up the query to retrieve the active sessions for the sepecified user that are to be terminated.
    
     String deleteUserSessionQuery = null;
 
     deleteUserSessionQuery = "SELECT SI_ID, SI_USERID, SI_NAME, SI_LASTLOGONTIME FROM CI_SYSTEMOBJECTS WHERE " +
       "SI_KIND = 'Connection' AND SI_FAILOVER_AVAILABLE_UNTIL = NULL AND SI_AUTHEN_METHOD != 'server-token' " +
       "AND SI_NAME = '" + userNameToDeleteSessions + "' ORDER BY SI_NAME";
    
     out.println("<br>The currently active sessions for user name '" + userNameToDeleteSessions + "' will be deleted.<br>");
    
  // Execute the query of the InfoStore.
     boInfoObjects = boInfoStore.query(deleteUserSessionQuery);
 
  if (boInfoObjects != null)
  {
   if (boInfoObjects.size() != 0)
   {
    // At least one session infoObject was returned.
   
    out.println("<br>There are " + boInfoObjects.size() + " current sessions for user name '" + userNameToDeleteSessions + "'.<br>");
   
    // Loop through all of the entries and delete all of the sessions.
    // Get the first entry.
    for (int i = 0; i < boInfoObjects.size(); i++)
    {
     boInfoObject = (IInfoObject) boInfoObjects.get(i);
    
     boInfoObjects.delete(boInfoObject);
    }
   
    // Commit the changes to the infoStore.
    boInfoStore.commit(boInfoObjects);
   
    out.println("<br>All of the active sessions have been deleted for user name '" + userNameToDeleteSessions + "'.<br>");
   }
   else
   {
    out.println("<br>A query of the infoStore returned no infoObjects when querying for the active sessions for user name '" + userNameToDeleteSessions + "'.<br>");
   }
  }
  else
  {
   out.println("<br>A query of the infoStore returned null when querying for the active sessions for user name '" + userNameToDeleteSessions + "'.<br>");
  }
}
catch (Exception ex)
{
  // Set the message to be displayed to the user to indicate that an
  // error has occurred and display the error message.
  out.println("An error was encountered.  A description of the error"
    + " is as follows:  " + ex.toString());
  // Log the error and the stack trace to the system out log file
  System.out.println("An error was encountered.  A description of the "
      + "error is written below:");
  System.out.println(ex);
  System.out.println("The stack trace for the error is written below:");
  ex.printStackTrace(System.out);
}
%>