javajarexecutable-jarbusiness-objectsbusiness-objects-sdk

business objects program object schedule


package com.ghc.bo.extract;

 //import com.crystaldecisions.sdk.plugin.desktop.program.IProgramBase;
 import com.crystaldecisions.sdk.framework.IEnterpriseSession;
 import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
 import com.crystaldecisions.sdk.exception.*;
 import com.crystaldecisions.sdk.framework.*;


 public class ExecuteExtract implements com.crystaldecisions.sdk.plugin.desktop.program.IProgramBase
 {


    public void run(IEnterpriseSession boEnterpriseSession, IInfoStore InfoStore, String[] args) 
    {
        System.out.println("Arguments are: ");

        for (int i=0; i<args.length; i++)
        {
            System.out.println("args[" + i + "]=" + args[i]);
        }

        try
        {
            String name = boEnterpriseSession.getUserInfo().getUserName();
            System.out.println("user \"" + name + "\" logged in via run() method");
        }
        catch(SDKException ske)
        {
            System.out.println(ske);
        }

        System.out.println("CMS is " + boEnterpriseSession.getCMSName());
    }

    public static void main(String[] args) 
    {

        IEnterpriseSession boEnterpriseSession = null;
        ISessionMgr boSessionMgr = null;
        IInfoStore boInfoStore = null;

        String userName = null;
        String cmsName = null;
        String password = null;
        String authType = null;     

        userName = args[0];
        password = args[1];
        cmsName = args[2];
        authType = args[3];


   if ((args.length == 4 || args.length == 5) && args[0] != null) 
       try
       {
          boSessionMgr = CrystalEnterprise.getSessionMgr();

          boEnterpriseSession = boSessionMgr.logon(userName, password, cmsName, authType);
          System.out.println("user \"" + userName + "\" logged in via main() method");

          boInfoStore = (IInfoStore) boEnterpriseSession.getService("", "InfoStore");
       }
       catch (SDKException e)
       {
           System.out.println(e.getMessage());
           System.exit(1);
       }

       //call the run() method
       ExecuteExtract pot = new ExecuteExtract();
       pot.run(boEnterpriseSession, boInfoStore, args);

    }    
 }

Hi I ran this, I did everything as is in here http://scn.sap.com/community/bi-platform/blog/2014/11/25/how-to-create-a-program-file-in-bi4#comment-613074 which is basically just to create a jar file and do minimal configuration for the schedule. I created the jar as runnable and utility jar, I packaged/extracted the included jars and left them out. I tried all those ways and I put in the Program Parameter the class name "ExecuteExtract" but I still get the error

Failed to load class: [ExecuteExtract]. Reason: [java.lang.ClassNotFoundException: ExecuteExtract].

Does anyone have an idea on what I am missing?


Solution

  • Either use the default package, or specify the fully qualified class name (com.ghc.bo.extract.ExecuteExtract) as the class name in the Program Object parameters.