Saturday, January 2, 2016

Using Hyperion CSSAPI from remote desktop (EPM 11.1.2.3.x-11.1.2.4.x )

Introduction

 CSSAPI is very interesting tool for me, because I'm a java developer and possibility of  using Java library allows to create more flexible integration solution. I have to create an extension for Hyperion Planning in last project which uses an integrated security with Shared Service. I used CSSAPI in my previous projects, but it only used authentication module, therefore I could easy debug and test it using mock libraries and then deploy it on the HSS server. But now I have to maintain user and groups, therefore I need a direct access to Hyperion Shared Services from my desktop where my IDE installed ).

Solution

I have read many posts about connecting to HSS through CSSAPI but some of it were deprecated (used older version of CSS API), other didn't contains full dependency list for CSSAPI..

What do you need at desktop?

1. Required  jars 
All documents and posts advice to add epm_j2se.jar  and css.jar to CLASSPATH  and everything will fine. I get all library dependencies from epm_j2se.jar  and get  approximately 200 jar files  , oh its not good, therefore a remove all unused jar and get minimum library list for CSSAPI.
These jars from the Hyperio EPM (required minimum to exclude java.lang.ClassNotFoundException ) :
Some libraries may have other versions...




2. Environment 
CSSAPI need EPM_ORACLE_HOME,EPM_ORACLE_INSTANCE  for example:
EPM_ORACLE_HOME=c:\Oracle\Middleware\EPMSystem11R
EPM_ORACLE_INSTANCE=c:\Oracle\Middleware\user_projects\epmsystem1
  variables, or you will get exception

3. Configuration file
(for EPM 11.1.2.3.x)   Copy configuration  file from EPM server to desktop in the specified location
%EPM_ORACLE_INSTANCE%\..\config\foundation\11.1.2.0\reg.properties
This file contains configuration for JDBC connection to EPM Registry
It is possible to get configuration file from URL /interop/framework/getCSSConfigFile but
only in previous CSS.jar version.
This method is deprecated in CSS.jar 11.1.2.3.500




Therefore configuration file is required.

Try №1

lets try to execute simple code, which gets instance for CSSSystem

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
private CSSSystem  cssSystem=null;
private HashMap localContext=new HashMap(2);
public void main(String[] args)
{

    try
    { 
          cssSystem=CSSSystem.getInstance(localContext,System.getenv("EPM_ORACLE_HOME")+"../logs");
     }catch(CSSException e)
     {
           e.printStackTrace();
     }
} 
After run I got an error:
 EPMCSS-00001: Failed to initialize EPM Shared Services security instance. Component SYSTEM9/FOUNDATION_SERVICES_PRODUCT/SHARED_SERVICES_PRODUCT is null in EPM System Registry. Verify EPM System Registry configuration.

It means that CSSAPI can't get data from Shared Services DB, usually in cause of  wrong database connection configuration in reg.properties file (user credentials or server name ). But after debuging I excluded these reason and could not determine error origin.
At last I've got it...

Try №2

The reason was in sql jdbc driver, which Hyperion EPM uses from version 11.1.2.3.
It is an weblogic.jdbc (in my case weblogic.jdbc.sqlserver.SQLServerDriver)
These drivers have limitation, and can't be used on remote desktop...


Therefore I reconfigure reg.properties files for using standard JDBC driver:
jdbc.url = jdbc\:sqlserver\://SERVER:PORT and etc
jdbc.driver = com.microsoft.sqlserver.jdbc.SQLServerDriver
And executed my sample code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
private CSSSystem  cssSystem=null;
private HashMap localContext=new HashMap(2);
public void main(String[] args){
    try{ 
        cssSystem=CSSSystem.getInstance(
  localContext,System.getenv("EPM_ORACLE_HOME")+"../logs");
    }catch(CSSException e){
           e.printStackTrace();
    }
}

Everything worked fine, no error, than I continued developing my project

P.S.

I'm going to devote some next posts to CSSAPI  (authentication and maintain users and groups)








 

8 comments:

  1. This is a great post on internet, firstly I am a hyperion beginner, your blog help me a lot
    Thank you very much.
    I want to use a remote machine to remote hyperion server With API too but I am sorry I have some question dont understand

    1) In my remote PC i dont install any EPM components
    so did you mean that I need copy all files from %EPM_ORACLE_INSTANCE% and %EPM_ORACLE_HOME% to remote PC?

    2) reg.propeties I dont understand how to configure it?
    this is my original reg.properties
    jdbc.url=jdbc\:weblogic\:sqlserver\://hostname\:1433;

    did I need to add one more "jdbc.url" like this?
    jdbc.url = com.microsoft.sqlserver.jdbc.SQLServerDriver


    Thank you again and have a nice day!

    ReplyDelete
    Replies
    1. I'm glad, that my post helps you.
      About your questions
      1. Yes you don't need to install any components only copy required library (which I mentioned in the post), and add it to CLASS_PATH when starts you java application
      2. You have to change only to parameters in reg.properties file:
      jdbc.url = jdbc\:sqlserver\://SERVER:PORT and etc
      jdbc.driver = com.microsoft.sqlserver.jdbc.SQLServerDriver
      It was a typo in the post, you don't need two JDBC.URL parameters (I have already fixed it). Driver depends of your RDBMS for shared services

      Delete
  2. HI
    oracle community reported to me that I need install some components on the remote machine.. maybe can solve my problem

    thank you

    ReplyDelete
  3. Thank you for your post.
    But I don't understand: you are saying "you don't need to install any components only copy required library (which I mentioned in the post), and add it to CLASS_PATH when starts you java application"
    but also "CSSAPI need EPM_ORACLE_HOME,EPM_ORACLE_INSTANCE for example:
    EPM_ORACLE_HOME=c:\Oracle\Middleware\EPMSystem11R
    EPM_ORACLE_INSTANCE=c:\Oracle\Middleware\user_projects\epmsystem1
    variables"

    Does it mean that I should just set EPM_ORACLE_HOME,EPM_ORACLE_INSTANCE and EPM_ORACLE_INSTANCE to some fake values? Or I should have these directories on my computer?

    And for some reason I don't have reg.properties file on machine with Hyperion

    I'm able to connect from the machine with Hyperion by using
    CSSSystem.getInstance(context, cssConfigUrl, ORACLE_INSTANCE);

    cssConfigUrl = file://...

    ReplyDelete
    Replies
    1. You are welcome!
      1. Both requirements are mandatory. You have to set EPM_ORACLE_HOME and EPM_ORACLE_INSTANCE environment variables and create directories on your computer. Because these directories and variables uses by CSSApi
      2. What version of Hyperion EPM do you use?
      because in 11.1.2.3 CSSSystem.getInstance(context, cssConfigUrl, ORACLE_INSTANCE) is deprecated and Hyperion EPM doesn't support CSSConfig URL (I tried this way, but have no success), therefore you need this function cssSystem=CSSSystem.getInstance(localContext,System.getenv("EPM_ORACLE_HOME"));

      Delete
    2. Thank you for your reply.
      I'm using 11.1.2.4

      About CSSConfig URL :
      In this post https://community.oracle.com/thread/2143457 there is mention that "The URL is protected and must be exposed through the shared services admin console. Under Security Options select "+Enable HTTP Access to Security Configuration+" This will allow access to the URL for the webservice:
      http://:/interop/framework/getCSSConfigFile". I wasn't able to set this option through interface (I found "Security Options" page but this option is not there), so I copied CSSConfig.xml file and specified URL as "file://C:/myproject/CSSConfig.xml"

      And I still don't understand about EPM_ORACLE_HOME and EPM_ORACLE_INSTANCE .
      Are you saying that I can create any directories (e.g. c:\temp1 and c:\temp2) and point EPM_ORACLE_HOME and EPM_ORACLE_INSTANCE to these new empty directories? Or should I copy these directories from machine with Hyperion?

      Delete
    3. 1. Don't waste time with useless efforts connecting using CSSConfig. CSSSystem needs SQL connection parameters (jdbc driver, database, sql login, sql password). These parameters are stores in reg.properties file. Look in CSSConfig file it stores Shared Services user directories configuration (read John's post http://john-goodwin.blogspot.ru/2010/01/epm-version-11-what-property-files.html). Therefore even if you call CSSSystem.getInstance(context, cssConfigUrl, ORACLE_INSTANCE) it doesn't work without reg.properties.

      2. Yes, you can create c:/temp1 and c:/temp2
      and point environment variable to it, but don't forget about paragraph №2:
      file %EPM_ORACLE_INSTANCE%\..\config\foundation\11.1.2.0\reg.properties must exists!

      Hope it helps


      Delete
    4. Thank you again for your help.
      It works now.

      Delete