0

我們最近升級了我們的業務對象XI環境,一個新的業務對象4.1,但現在我們遇到一些問題,它Business Objects的JAVA SDK ISessionMgr.logon掛

我們的Java Web應用程序託管在WebLogic服務器上使用BO SDK安排另一臺服務器上的Crystal Report(VM的Windows + 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 retireve with username'" + username + "' password '" + password + "' cmsName '" + cmsName + "' "); 
    } 
    else { 
     logger.info("Class CrystalReportHelper, BusinessObjectEnterprise Session Retireve 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 retireved 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,報告名稱,並報告提示參數使用
  2. BO_INFO_STORE =「InfoStore」; 「
  3. REPORT_QUERY =」Select * from 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(username,password,cmsName,CeProgID.SEC_ENTERPRISE);

下面是從Weblogic的堆棧跟蹤發生這種情況時:

 "[ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock [email protected] 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$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) 

     "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) 

這從來沒有在我們的薄熙來環境在發生之前。

回答

0

嗨找到我自己的答案。

對於面臨同樣問題的人們:我們在兩臺機器之間有防火牆。

當我們打開我們的應用程序和BO之間的連接時,該端口在應用程序端動態選擇。

現在,我們禁用了防火牆,並正在研究一種設置應用端使用的靜態端口的方法。

相關問題