Content Management and Capture

 View Only
Expand all | Collapse all

Access Content Manager via Java API's

  • 1.  Access Content Manager via Java API's

    Posted Wed July 06, 2022 09:44 AM
    Dear All,

    I am new to Content Manager. We have a requirement to add groups to users in Content Manager. Since the no of edits are close to 100K, I am creating a Java program to add the groups programmatically. 

    I found the sample program to connect to ICM and tried to connect to content manager but it doesn't work. I am running the Java program via cmd line and once I execute the program, nothing happens. The message says 'Connecting to Library server' but nothing happens.

    DKDatastoreICM dsICM = new DKDatastoreICM();  // Create new datastore object.
     dsICM.connect(database,userName,password,""); // Connect to the datastore.

    The Java program resides in CM server and I think this is the correct place to execute the program. Also, please let me know if setting of all environment variables mentioned in cmbenv81.bat file is required to connect to CM because I have added the required libraries and my Java program compiles without any issue.

    Below is the information in logs,

    [ERR]: 07/05/2022 at 13:13:11.401 GMT @ XXXXX (172.28.229.8);  # com.ibm.mm.sdk.logtool.DKLogManagerFactory_default
    [USR]: XXXXXX (S:\Users\XXXXXX) @ S:\Programs\IBM\SQLLIB\java\jdk\bin
    [THD]: main ( ee1e83dd )
    [THG]: main = { Thread-5, Attach API wait loop, Signal Dispatcher, main }
    [LOC]: com.ibm.mm.sdk.server.DKDatastoreICM:checkIsCICS
    [MSG]: [ WARN] DKLogAccessor INTERNAL ERROR: DKLogAccessor can not instantiate the log manager of type com.ibm.mm.sdk.logtool.DKLogManagerFactory_Log4J.
    [ NOTE] The default log manager and default settings will be used.  com.ibm.mm.sdk.logtool.DKLogManagerFactory_default

    Any insights of how to connect would be highly appreciated.

    Thanks,
    Balaji D N

    ------------------------------
    Balaji N
    ------------------------------


  • 2.  RE: Access Content Manager via Java API's

    Posted Mon July 18, 2022 02:07 PM
    Hi Balaji,

    The warning you see is likely because the program cannot find the log4j jar files.  Although you do not need to run cmbenv81.bat, if you did run this bat file, it would add all of the correct jar files to the classpath and make sure all the ini files were setup properly to access the server. 

    It looks like you are using the 8.6 API for this program with the reference to com.ibm.mm.sdk.logtool.DKLogManagerFactory_Log4J.  If so, the log4j jar file would be found here: %IBMCMROOT%\lib\log4j-1.2.15.jar.  Likely adding this to your classpath will resolve the warning above.

    In 8.7 we switched to using log4J 2, so the jar files are different.  This is also an advantage of running cmbenv81.bat, as it takes into account what release you are using and includes the correct jar files.

    Note that the error above is just a warning, so it should not prevent your program from running.  It does prevent the log4j trace settings from being used and it will likely write the trace file to the current directory with the name dklog.log rather than where the log is generally configured to go.  This may be ok for your program, but likely this would need to be resolved if opening a support case, so best to resolve it.

    For more information on setting the classpath for CM 8.6 see:
    https://www.ibm.com/docs/en/content-manager/8.6.0?topic=applications-java-original-equipment-manufacturer-oem-api-toolkit
    For 8.7 see:
    https://www.ibm.com/docs/en/content-manager/8.7.0?topic=applications-java-original-equipment-manufacturer-oem-api-toolkit

    Let me know if you have additional question...  Thanks.

    ------------------------------
    Randy Richardt
    ------------------------------