title: Business Objects JAVA SDK ISessionMgr.logon hangs
body: <p>We recently upgraded our Business Object XI environment for a new Business Objects 4.1 but we are now experiencing some issues with it</p>
  <p>We have an Java web application hosted on a Weblogic server  that use the BO SDK to schedule Crystal Report on another server (Windows VM + tomcat server &amp; BO 4.1)</p>
  <p>Here’s the code used for the schedule :</p>
  <pre><code>  /**
     * Schedule a report inside CrystalReport
     */
    public void executeReport(ReportContext reportContext) throws Exception { 
    logger.info(&quot;Class CrystalReportHelper, Executing report request for report '&quot; + reportContext.getReportName() + &quot;'&quot;);
  
    IEnterpriseSession enterpriseSession = null;
    try {
       String password = getPassword(reportContext);
       logger.info(&quot;Class CrystalReportHelper, Retrievieving password &quot;);
       if (password != null) {
          if (logger.isDebugEnabled()) {
             logger.debug(&quot;Class CrystalReportHelper, Password obtained '&quot; + password + &quot;'&quot;);
          }
          else {
             logger.info(&quot;Class CrystalReportHelper, Password obtained &quot;);
          }
       }
       else {
          logger.error(&quot;Class CrystalReportHelper, Invalid password for BO Logon&quot;);
          throw new Exception(&quot;Invalid password for BO Logon - password is null&quot;);
       }
  
       String username = getUserName(reportContext);
       logger.info(&quot;Class CrystalReportHelper, Retrievieving username &quot;);
       if (username != null) {
          logger.info(&quot;Class CrystalReportHelper, User name obtained '&quot; + username + &quot;'&quot;);
       }
       else {
          logger.error(&quot;Class CrystalReportHelper, Invalid username for BO Logon&quot;);
          throw new Exception(&quot;Invalid username for BO Logon - username is null&quot;);
       }
  
       String cmsName = getCentralManagementServerName();
       logger.info(&quot;Class CrystalReportHelper, Retrievieving Central Management Server Name &quot;);
       if (cmsName != null) {
          logger.info(&quot;Class CrystalReportHelper,Central Management Server Name obtained = &quot; + cmsName);
       }
       else {
          logger.error(&quot;Class CrystalReportHelper, Invalid Central Management Server Name for BO Logon.&quot;);
          throw new Exception(&quot;Invalid Central Management Server Name for BO Logon - Central Management Server Name is null&quot;);
       }
  
       enterpriseSession = getSession(username, password, cmsName);
       if (logger.isDebugEnabled()) {
          logger.debug(&quot;Class CrystalReportHelper, Retrieving BusinessObjectEnterprise Session with username'&quot; + username + &quot;' password '&quot; + password + &quot;' cmsName '&quot; + cmsName + &quot;' &quot;);
       }
       else {
          logger.info(&quot;Class CrystalReportHelper, Retrieving BusinessObjectEnterprise Session with username'&quot; + username + &quot;' password '&quot; + &quot;XXXX&quot; + &quot;' cmsName '&quot; + cmsName + &quot;' &quot;);
       }
       if (enterpriseSession == null) {
          logger.error(&quot;Class CrystalReportHelper, Coud not retrieve BusinessObjectEnterprise Session with username'&quot; + username + &quot;' password '&quot; + password + &quot;' cmsName '&quot; + cmsName + &quot;' &quot;);
          throw new Exception(&quot;Could not retreive BO Session with username : &quot; + username + &quot; and CMS : &quot; + cmsName);
       }
       if (logger.isDebugEnabled()) {
          logger.debug(&quot;Class CrystalReportHelper, BusinessObjectEnterprise Session retrieve with username'&quot; + username + &quot;' password '&quot; + password + &quot;' cmsName '&quot; + cmsName + &quot;' &quot;);
       }
       else {
          logger.info(&quot;Class CrystalReportHelper, BusinessObjectEnterprise Session retrieve with username'&quot; + username + &quot;' password '&quot; + &quot;XXXX&quot; + &quot;' cmsName '&quot; + cmsName + &quot;' &quot;);
       }
  
       IInfoStore infoStore = (IInfoStore) enterpriseSession.getService(cmsName, BO_INFO_STORE);
       logger.info(&quot;Class CrystalReportHelper, Retrieving BO service with cmsName'&quot; + cmsName + &quot;' BO_INFO_STORE '&quot; + BO_INFO_STORE + &quot;'&quot;);
       if (infoStore == null) {
          logger.error(&quot;Class CrystalReportHelper, Coud not obtain BO service with cmsName'&quot; + cmsName + &quot;' BO_INFO_STORE '&quot; + BO_INFO_STORE + &quot;'&quot;);
          throw new Exception(&quot;Could not obtain BO service : &quot; + BO_INFO_STORE);
       }
  
       // Queries the CMS for the report.
       logger.info(&quot;Class CrystalReportHelper, BO service retrieved with cmsName'&quot; + cmsName + &quot;' BO_INFO_STORE '&quot; + BO_INFO_STORE + &quot;'&quot;);
  
       String queryReport = REPORT_QUERY.replaceFirst(REPLACE_REPORT_NAME, getReportName(reportContext));
  
       logger.info(&quot;Class CrystalReportHelper, Executing query report '&quot; + queryReport + &quot;'.&quot;);
       IInfoObjects reports = infoStore.query(queryReport);
       if (reports.size() == 0) {
          logger.error(&quot;Class CrystalReportHelper, Report '&quot; + queryReport + &quot;' not found..&quot;);
          throw new Exception(&quot;Report &quot; + getReportName(reportContext) + &quot; not found in BusinessObject&quot;);
       }
       IReport report = (IReport) reports.get(0);
  
       // Set report format.
       IReportFormatOptions reportFormat = report.getReportFormatOptions();
  
       int formatType = IReportFormatOptions.CeReportFormat.CRYSTAL_REPORT;
       reportFormat.setFormat(formatType);
  
       String destinationInbox = getDestinationInbox(reportContext);
       IDestinationPlugin destinationPlugin = getDestinationPlugin(infoStore, destinationInbox);
  
       // Create an interface to the scheduling options for the report.
       ISchedulingInfo scheduleInfo = report.getSchedulingInfo();
       scheduleInfo.setType(CeScheduleType.ONCE);
       scheduleInfo.setRightNow(true);
  
       IDestination destination = scheduleInfo.getDestination();
       destination.setFromPlugin(destinationPlugin);
  
       // copy the report parameters
       this.setParameters(reportContext, report);
  
       logger.info(&quot;Class CrystalReportHelper, Scheduling report '&quot; + getReportName(reportContext) + &quot;'. &quot;);
       infoStore.schedule(reports);
       logger.info(&quot;Class CrystalReportHelper, Report '&quot; + getReportName(reportContext) + &quot;' has been scheduled. &quot;);
  
       if (reportContext.isEmailRequired() &amp; isEmailEnabled()) {
          sendEmail(reportContext);
       }
    }
    catch (SDKRuntimeException SDKre) {
       logger.error(&quot;Class CrystalReportHelper, Could not execute report request for report '&quot; + reportContext.getReportName() + &quot;' caught SDKRuntimeException:  &quot; + SDKre.getMessage(), SDKre);
       throw new Exception(SDKre);
    }
    catch (SDKException SDKe) {
       logger.error(&quot;Class CrystalReportHelper, Could not execute report request for report '&quot; + reportContext.getReportName() + &quot;' caught SDKException:  &quot; + SDKe.getMessage(), SDKe);
       throw new Exception(SDKe);
    }
    finally {
       if (null != enterpriseSession) {
          enterpriseSession.logoff();
       }
    }
  </code></pre>
  <p>Here’s some data info :</p>
  <ol>
  <li>Reportcontext contains things like user/password for BO , report name and report prompt parameter to use</li>
  <li>BO_INFO_STORE = “InfoStore”;</li>
  <li>REPORT_QUERY = &quot;Select * From CI_INFOOBJECTS WHERE SI_NAME='&quot; + REPLACE_REPORT_NAME + &quot;' AND SI_INSTANCE = 'false'&quot;;</li>
  </ol>
  <p>Here's the method getSession used to connect to BO :</p>
  <pre><code>    /**
       * return BusinessObjectEnterprise session
       *
       * @param username
       * @param password
       * @return IEnterpriseSession
       * @throws SDKException
       */
       public IEnterpriseSession getSession(String username, String password,      String cmsName) throws SDKException {
       logger.debug(&quot;Class CrystalReportHelper, Retrieving    BusinessObjectEnterprise Session  username'&quot; + username + &quot;' password '&quot; +   password + &quot;' cmsName '&quot; + cmsName + &quot;' &quot;);
  
    IEnterpriseSession enterpriseSession = null;
    ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
  
    boolean isAuthenticateEnterprise = getReportProperties().getAuthenticationTypeEnterprise();
    logger.debug(&quot;Class CrystalReportHelper, isAuthenticateEnterprise  '&quot; + isAuthenticateEnterprise + &quot;' &quot;);
    if (isAuthenticateEnterprise) {
       enterpriseSession = sessionMgr.logon(username, password, cmsName, CeProgID.SEC_ENTERPRISE);
    }
    else {
       enterpriseSession = sessionMgr.logon(username, password, cmsName, CeProgID.SEC_LDAP);
    }
  
    logger.debug(&quot;Class CrystalReportHelper, BusinessObjectEnterprise Session  obtained for username'&quot; + username + &quot;' password '&quot; + password + &quot;' cmsName '&quot; + cmsName + &quot;' &quot;);
    return enterpriseSession;
  }
  </code></pre>
  <p>The problem we’re experiencing is sometimes the process will hang on this line for about 45min :</p>
  <p>enterpriseSession = sessionMgr.logon(username, password, cmsName, CeProgID.SEC_ENTERPRISE);</p>
  <p>Here’s a stacktrace from Weblogic when this occurs :</p>
  <pre><code>        &quot;[ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)'&quot; waiting for lock java.lang.Object@3d24ae2c WAITING
        
             java.lang.Object.wait(Native Method)
        
             java.lang.Object.wait(Object.java:485)
        
                         com.crystaldecisions.thirdparty.com.ooc.OB.Downcall.waitUntilCompleted(Downcall.java:831)
        
                         com.crystaldecisions.thirdparty.com.ooc.OB.GIOPClientWorkerThreaded.receive(GIOPClientWorkerThreaded.java:327)
        
                         com.crystaldecisions.thirdparty.com.ooc.OB.GIOPClientWorkerThreaded.sendReceive(GIOPClientWorkerThreaded.java:353)
        
             com.crystaldecisions.thirdparty.com.ooc.OB.Downcall.request(Downcall.java:336)
        
             com.crystaldecisions.thirdparty.com.ooc.OB.DowncallStub.invoke(DowncallStub.java:583)
        
             com.crystaldecisions.thirdparty.com.ooc.CORBA.Delegate.invoke(Delegate.java:579)
        
                         com.crystaldecisions.thirdparty.org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:125)
        
                         com.crystaldecisions.enterprise.ocaframework.idl.ImplServ._OSCAFactoryStub.newService(_OSCAFactoryStub.java:78)
        
             com.crystaldecisions.enterprise.ocaframework.i.a(Unknown Source)
        
             com.crystaldecisions.enterprise.ocaframework.i.a(Unknown Source)
        
             com.crystaldecisions.enterprise.ocaframework.i.buildClusterInfo(Unknown Source)
        
             com.crystaldecisions.enterprise.ocaframework.aa.int(Unknown Source)
        
             com.crystaldecisions.enterprise.ocaframework.ServiceMgr.int(Unknown Source)
        
             com.crystaldecisions.enterprise.ocaframework.p.a(Unknown Source)
        
             com.crystaldecisions.enterprise.ocaframework.ServiceMgr.getManagedService(Unknown Source)
        
             com.crystaldecisions.sdk.occa.security.internal.f.if(Unknown Source)
        
             com.crystaldecisions.sdk.occa.security.internal.f.&lt;init&gt;(Unknown Source)
        
                         com.crystaldecisions.sdk.occa.security.internal.SecurityFactory.makeSecuritySession(Unknown Source)
        
             com.crystaldecisions.sdk.occa.security.internal.t.a(Unknown Source)
        
             com.crystaldecisions.sdk.occa.security.internal.t.userLogon(Unknown Source)
        
             com.crystaldecisions.sdk.occa.security.internal.l.userLogon(Unknown Source)
        
             com.crystaldecisions.sdk.framework.internal.b.logon(Unknown Source)
        
                         com.tranme.guide.commonservices.report.CrystalReportHelper.getSession(CrystalReportHelper.java:156)
        
                         com.tranme.guide.commonservices.report.CrystalReportHelper.getReportInfoObjectsByReportName(CrystalReportHelper.java:503)
        
                         com.tranme.guide.notificationmgt.manager.reports.util.ReportManagementTools.getReportInstanceStatuses(ReportManagementTools.java:81)
        
                         com.tranme.guide.notificationmgt.manager.reports.util.ReportManagementTools.getGenerationStatusResults(ReportManagementTools.java:51)
        
                         com.tranme.guide.notificationmgt.manager.BaseNotificationManager.updateReportGenerationStatus(BaseNotificationManager.java:244)
        
                         com.tranme.guide.notificationmgt.business.ejb.impl.NotificationManagementFacadeBeanImpl.updateReportGenerationStatus(NotificationManagementFacadeBeanImpl.java:123)
        
                         com.tranme.guide.notificationmgt.business.ejb.impl.NotificationManagementFacadeBeanImpl_z3lp9c_EOImpl.updateReportGenerationStatus(NotificationManagementFacadeBeanImpl_z3lp9c_EOImpl.java:140)
        
                         com.tranme.guide.notificationmgt.business.ejb.impl.NotificationManagementFacadeBeanImpl_z3lp9c_EOImpl_WLSkel.invoke(Unknown Source)
        
             weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
        
             weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
        
             weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
        
             weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
        
             weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
        
             weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
        
             weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
        
             weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        
             weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
        
          &quot;Business Objects - Sessions Clean up&quot; TIMED_WAITING
        
             java.lang.Thread.sleep(Native Method)
        
             com.crystaldecisions.enterprise.ocaframework.n.run(Unknown Source)
        
             java.lang.Thread.run(Thread.java:619)
        
          &quot;OracleTimeoutPollingThread&quot; TIMED_WAITING
       
             java.lang.Thread.sleep(Native Method)
        
             oracle.jdbc.driver.OracleTimeoutPollingThread.run(OracleTimeoutPollingThread.java:150)
  </code></pre>
  <p>This never happened before on our BO XI environment.</p>