业务对象 JAVA SDK ISessionMgr.logon 挂起

Business Objects JAVA SDK ISessionMgr.logon hangs

我们最近为新的 Business Objects 4.1 升级了我们的 Business Object XI 环境,但我们现在遇到了一些问题

我们有一个 Java Web 应用程序托管在 Weblogic 服务器上,它使用 BO SDK 在另一台服务器上安排 Crystal 报告(Windows VM + tomcat 服务器& BO 4.1)

这是用于时间表的代码:

  /**
   * Schedule a report inside CrystalReport
   */
  public void executeReport(ReportContext reportContext) throws Exception { 
  logger.info("Class CrystalReportHelper, Executing report request for report '" + reportContext.getReportName() + "'");

  IEnterpriseSession enterpriseSession = null;
  try {
     String password = getPassword(reportContext);
     logger.info("Class CrystalReportHelper, Retrievieving password ");
     if (password != null) {
        if (logger.isDebugEnabled()) {
           logger.debug("Class CrystalReportHelper, Password obtained '" + password + "'");
        }
        else {
           logger.info("Class CrystalReportHelper, Password obtained ");
        }
     }
     else {
        logger.error("Class CrystalReportHelper, Invalid password for BO Logon");
        throw new Exception("Invalid password for BO Logon - password is null");
     }

     String username = getUserName(reportContext);
     logger.info("Class CrystalReportHelper, Retrievieving username ");
     if (username != null) {
        logger.info("Class CrystalReportHelper, User name obtained '" + username + "'");
     }
     else {
        logger.error("Class CrystalReportHelper, Invalid username for BO Logon");
        throw new Exception("Invalid username for BO Logon - username is null");
     }

     String cmsName = getCentralManagementServerName();
     logger.info("Class CrystalReportHelper, Retrievieving Central Management Server Name ");
     if (cmsName != null) {
        logger.info("Class CrystalReportHelper,Central Management Server Name obtained = " + cmsName);
     }
     else {
        logger.error("Class CrystalReportHelper, Invalid Central Management Server Name for BO Logon.");
        throw new Exception("Invalid Central Management Server Name for BO Logon - Central Management Server Name is null");
     }

     enterpriseSession = getSession(username, password, cmsName);
     if (logger.isDebugEnabled()) {
        logger.debug("Class CrystalReportHelper, Retrieving BusinessObjectEnterprise Session with username'" + username + "' password '" + password + "' cmsName '" + cmsName + "' ");
     }
     else {
        logger.info("Class CrystalReportHelper, Retrieving BusinessObjectEnterprise Session with username'" + username + "' password '" + "XXXX" + "' cmsName '" + cmsName + "' ");
     }
     if (enterpriseSession == null) {
        logger.error("Class CrystalReportHelper, Coud not retrieve BusinessObjectEnterprise Session with username'" + username + "' password '" + password + "' cmsName '" + cmsName + "' ");
        throw new Exception("Could not retreive BO Session with username : " + username + " and CMS : " + cmsName);
     }
     if (logger.isDebugEnabled()) {
        logger.debug("Class CrystalReportHelper, BusinessObjectEnterprise Session retrieve with username'" + username + "' password '" + password + "' cmsName '" + cmsName + "' ");
     }
     else {
        logger.info("Class CrystalReportHelper, BusinessObjectEnterprise Session retrieve with username'" + username + "' password '" + "XXXX" + "' cmsName '" + cmsName + "' ");
     }

     IInfoStore infoStore = (IInfoStore) enterpriseSession.getService(cmsName, BO_INFO_STORE);
     logger.info("Class CrystalReportHelper, Retrieving BO service with cmsName'" + cmsName + "' BO_INFO_STORE '" + BO_INFO_STORE + "'");
     if (infoStore == null) {
        logger.error("Class CrystalReportHelper, Coud not obtain BO service with cmsName'" + cmsName + "' BO_INFO_STORE '" + BO_INFO_STORE + "'");
        throw new Exception("Could not obtain BO service : " + BO_INFO_STORE);
     }

     // Queries the CMS for the report.
     logger.info("Class CrystalReportHelper, BO service retrieved with cmsName'" + cmsName + "' BO_INFO_STORE '" + BO_INFO_STORE + "'");

     String queryReport = REPORT_QUERY.replaceFirst(REPLACE_REPORT_NAME, getReportName(reportContext));

     logger.info("Class CrystalReportHelper, Executing query report '" + queryReport + "'.");
     IInfoObjects reports = infoStore.query(queryReport);
     if (reports.size() == 0) {
        logger.error("Class CrystalReportHelper, Report '" + queryReport + "' not found..");
        throw new Exception("Report " + getReportName(reportContext) + " not found in BusinessObject");
     }
     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("Class CrystalReportHelper, Scheduling report '" + getReportName(reportContext) + "'. ");
     infoStore.schedule(reports);
     logger.info("Class CrystalReportHelper, Report '" + getReportName(reportContext) + "' has been scheduled. ");

     if (reportContext.isEmailRequired() & isEmailEnabled()) {
        sendEmail(reportContext);
     }
  }
  catch (SDKRuntimeException SDKre) {
     logger.error("Class CrystalReportHelper, Could not execute report request for report '" + reportContext.getReportName() + "' caught SDKRuntimeException:  " + SDKre.getMessage(), SDKre);
     throw new Exception(SDKre);
  }
  catch (SDKException SDKe) {
     logger.error("Class CrystalReportHelper, Could not execute report request for report '" + reportContext.getReportName() + "' caught SDKException:  " + SDKe.getMessage(), SDKe);
     throw new Exception(SDKe);
  }
  finally {
     if (null != enterpriseSession) {
        enterpriseSession.logoff();
     }
  }

这是一些数据信息:

  1. Reportcontext 包含 BO 的 user/password、报告名称和要使用的报告提示参数等内容
  2. BO_INFO_STORE = “信息存储”;
  3. REPORT_QUERY = "Select * 从 CI_INFOOBJECTS WHERE SI_NAME='" + REPLACE_REPORT_NAME + "' AND SI_INSTANCE = 'false'";

这是用于连接到 BO 的 getSession 方法:

    /**
     * return BusinessObjectEnterprise session
     *
     * @param username
     * @param password
     * @return IEnterpriseSession
     * @throws SDKException
     */
     public IEnterpriseSession getSession(String username, String password,      String cmsName) throws SDKException {
     logger.debug("Class CrystalReportHelper, Retrieving    BusinessObjectEnterprise Session  username'" + username + "' password '" +   password + "' cmsName '" + cmsName + "' ");

  IEnterpriseSession enterpriseSession = null;
  ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();

  boolean isAuthenticateEnterprise = getReportProperties().getAuthenticationTypeEnterprise();
  logger.debug("Class CrystalReportHelper, isAuthenticateEnterprise  '" + isAuthenticateEnterprise + "' ");
  if (isAuthenticateEnterprise) {
     enterpriseSession = sessionMgr.logon(username, password, cmsName, CeProgID.SEC_ENTERPRISE);
  }
  else {
     enterpriseSession = sessionMgr.logon(username, password, cmsName, CeProgID.SEC_LDAP);
  }

  logger.debug("Class CrystalReportHelper, BusinessObjectEnterprise Session  obtained for username'" + username + "' password '" + password + "' cmsName '" + cmsName + "' ");
  return enterpriseSession;
}

我们遇到的问题是有时进程会在此行挂起大约 45 分钟:

enterpriseSession = sessionMgr.logon(用户名, 密码, cmsName, CeProgID.SEC_ENTERPRISE);

这是发生这种情况时来自 Weblogic 的堆栈跟踪:

        "[ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)'" 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.<init>(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.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)
      
        "Business Objects - Sessions Clean up" TIMED_WAITING
      
           java.lang.Thread.sleep(Native Method)
      
           com.crystaldecisions.enterprise.ocaframework.n.run(Unknown Source)
      
           java.lang.Thread.run(Thread.java:619)
      
        "OracleTimeoutPollingThread" TIMED_WAITING
     
           java.lang.Thread.sleep(Native Method)
      
           oracle.jdbc.driver.OracleTimeoutPollingThread.run(OracleTimeoutPollingThread.java:150)

这在我们的 BO XI 环境中从未发生过。

嗨,找到了我自己的答案。

对于面临同样问题的人:我们在两台机器之间设置了防火墙。

当我们打开我们的应用程序和 BO 之间的连接时,端口是在应用程序端动态选择的。

目前,我们禁用了防火墙并正在寻找一种方法来设置静态端口以在应用程序端使用。