如何在Java SDK中加载Unx

2020-08-22 15:18发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


你好。

我想加载unx Universe,但是在运行步骤时出现错误

 businessLayer =(RelationalBusinessLayer)localResourceService.load(blxPath); 

由以下原因引起:java.lang.NullPointerException

导入com.businessobjects.mds.universe.Universe;
 导入com.crystaldecisions.sdk.exception.SDKException;
 导入com.crystaldecisions.sdk.framework.CrystalEnterprise;
 导入com.crystaldecisions.sdk.framework.IEnterpriseSession;
 导入com.crystaldecisions.sdk.framework.ISessionMgr;
 导入com.crystaldecisions.sdk.plugin.CeProgID;
 导入com.sap.sl.sdk.authoring.cms.CmsResourceService;
 导入com.sap.sl.sdk.authoring.businesslayer。*;
 导入com.sap.sl.sdk.authoring.datafoundation。*;
 导入com.sap.sl.sdk.authoring.local.LocalResourceService;
 导入com.sap.sl.sdk.framework.SlContext;
 导入com.sap.sl.sdk.framework.cms.CmsSessionService;
 公共课Pr {
  公共静态void main(String [] args){
   字符串用户名=" g9301";
      字符串密码=" passw";
      字符串服务器="";
      字符串auth =" secEnterprise";
      字符串cmspath ="/img/Universes";
      字符串unxname =" eFashion.unx";
      字符串tempFolder =" mytemp";
   SlContext context = SlContext.create();
 IEnterpriseSession enterpriseSession = null;
      尝试
      {
       ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
       enterpriseSession = sessionMgr.logon(用户名,密码,服务器,身份验证);
          CmsSessionService cmsSessionService =
            context.getService(CmsSessionService.class);
          cmsSessionService.setSession(enterpriseSession);
          CmsResourceService cmsService =
            context.getService(CmsResourceService.class);
          LocalResourceService localResourceService =
            context.getService(LocalResourceService.class);
          BusinessLayerFactory businessLayerFactory =
            context.getService(BusinessLayerFactory.class);
          DataFoundationFactory dataFoundationFactory =
            context.getService(DataFoundationFactory.class);
                
          System.out.println("导入Universe");
          System.out.println(cmspath +"/" + unxname);
         
          字符串blxPath =
            cmsService.retrieveUniverse(cmspath +"/" + unxname,tempFolder,true);
          System.out.println(blxPath);
         
          System.out.println("正在加载Universe");
          RelationalBusinessLayer businessLayer = null;
          尝试
          {
           businessLayer =(RelationalBusinessLayer)localResourceService.load(blxPath);
          }
          catch(例外e){
           System.out.println(e.getMessage());
           e.printStackTrace();
    }
          字符串dfxPath = businessLayer.getDataFoundationPath();
      }
      捕获(SDKException e)
      {
       System.out.println(" 111");
      }
      最后
      {
         如果(上下文!= null)
         {
           context.close();
         }
         如果(enterpriseSession!= null)
         {
           enterpriseSession.logoff();
         }
         System.out.println("完成");
      }
 

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


你好。

我想加载unx Universe,但是在运行步骤时出现错误

 businessLayer =(RelationalBusinessLayer)localResourceService.load(blxPath); 

由以下原因引起:java.lang.NullPointerException

导入com.businessobjects.mds.universe.Universe;
 导入com.crystaldecisions.sdk.exception.SDKException;
 导入com.crystaldecisions.sdk.framework.CrystalEnterprise;
 导入com.crystaldecisions.sdk.framework.IEnterpriseSession;
 导入com.crystaldecisions.sdk.framework.ISessionMgr;
 导入com.crystaldecisions.sdk.plugin.CeProgID;
 导入com.sap.sl.sdk.authoring.cms.CmsResourceService;
 导入com.sap.sl.sdk.authoring.businesslayer。*;
 导入com.sap.sl.sdk.authoring.datafoundation。*;
 导入com.sap.sl.sdk.authoring.local.LocalResourceService;
 导入com.sap.sl.sdk.framework.SlContext;
 导入com.sap.sl.sdk.framework.cms.CmsSessionService;
 公共课Pr {
  公共静态void main(String [] args){
   字符串用户名=" g9301";
      字符串密码=" passw";
      字符串服务器="";
      字符串auth =" secEnterprise";
      字符串cmspath ="/img/Universes";
      字符串unxname =" eFashion.unx";
      字符串tempFolder =" mytemp";
   SlContext context = SlContext.create();
 IEnterpriseSession enterpriseSession = null;
      尝试
      {
       ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
       enterpriseSession = sessionMgr.logon(用户名,密码,服务器,身份验证);
          CmsSessionService cmsSessionService =
            context.getService(CmsSessionService.class);
          cmsSessionService.setSession(enterpriseSession);
          CmsResourceService cmsService =
            context.getService(CmsResourceService.class);
          LocalResourceService localResourceService =
            context.getService(LocalResourceService.class);
          BusinessLayerFactory businessLayerFactory =
            context.getService(BusinessLayerFactory.class);
          DataFoundationFactory dataFoundationFactory =
            context.getService(DataFoundationFactory.class);
                
          System.out.println("导入Universe");
          System.out.println(cmspath +"/" + unxname);
         
          字符串blxPath =
            cmsService.retrieveUniverse(cmspath +"/" + unxname,tempFolder,true);
          System.out.println(blxPath);
         
          System.out.println("正在加载Universe");
          RelationalBusinessLayer businessLayer = null;
          尝试
          {
           businessLayer =(RelationalBusinessLayer)localResourceService.load(blxPath);
          }
          catch(例外e){
           System.out.println(e.getMessage());
           e.printStackTrace();
    }
          字符串dfxPath = businessLayer.getDataFoundationPath();
      }
      捕获(SDKException e)
      {
       System.out.println(" 111");
      }
      最后
      {
         如果(上下文!= null)
         {
           context.close();
         }
         如果(enterpriseSession!= null)
         {
           enterpriseSession.logoff();
         }
         System.out.println("完成");
      }
 
付费偷看设置
发送
1条回答
追夢秋陽
1楼 · 2020-08-22 15:46.采纳回答

您使用的是Java 1.8还是其他版本?

请参见 https://launchpad。 support.sap.com/#/notes/0002641288

发生此问题是因为我们的某些jar文件与Java 1.9不兼容,因此即使它们在类路径中也是如此 ,它们不会被加载。 这会导致NoClassDefFound异常

一周热门 更多>