Control-M/CM for SAP may display error Failed: : java.lang.OutOfMemoryError: Java heap space when trying to process a large response from SAP

Version 1
    Share This:

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    Control-M for SAP


    BMC Control-M for SAP



    Failed to connect to Control-M/CM for SAP. Maximum HTTP calls retries reached (HttpCallMaxRetry).


    The <ctm_agent>/proclog/cmsap.log
    28 10:22:49:452 E  367 InvokerImpl.invoke[45]   Failed: : java.lang.OutOfMemoryError: Java heap space
    28 10:22:49:452 E  367 InvokerImpl.invoke[46]   Return empty answer!


    The out of memory exceptions in the logs for the Control-M/CM for SAP occur when attempting to process a large response from SAP.


    Following the steps below will allow the Java process more memory to handle large responses from the SAP system.




    1. Login as the Control-M/Agent user
    2. Navigate to the <ctm_agent_home>/cm/SAP/EXE directory
    3. Make a backup copy of the file (if Unix) or sapcmbe.cmd (if Windows).
    4. Open the file for editing (if Unix) or sapcmbe.cmd (if Windows).
    5. Find the the text: -Xmx256m
        This will be at the bottom or the file

    6. Change the text to read: -Xmx512m
    7. Save the file
    8. Stop Control-M/Agent
    9. Execute the command " stop" (if Unix) or "sapcmbe.cmd stop" (If Windows) to stop the Control-M for SAP java container (JCO)
    10. Retry the action that caused the issue.
         No need to restart anything as the java container will start automatically
    11. If the Java OutOfMemoryError messages continue to occur, repeat steps 1-9 except change -Xmx512m to -Xmx1024m
         Increment by 512m increments

    Unix example:
    From the
    $CONTROLM/cm/SAP/${java_dir}/java ${FLAG64BIT.EN_US} -Xms32m -Xmx256m -Djava.library.path=${exe_path}/sapjco -classpath ${exe_path}/ctmsap.jar:${exe_path}/sapjco/sapjco3.jar com.bmc.ctm.cmsap.exe.SAP${ACTION.EN_US} ${DEBUG.EN_US} ${RESERVED.EN_US} >&2

    $CONTROLM/cm/SAP/${java_dir}/java ${FLAG64BIT.EN_US} -Xms32m -Xmx512m -Djava.library.path=${exe_path}/sapjco -classpath ${exe_path}/ctmsap.jar:${exe_path}/sapjco/sapjco3.jar com.bmc.ctm.cmsap.exe.SAP${ACTION.EN_US} ${DEBUG.EN_US} ${RESERVED.EN_US} >&2


    In addition to the above, on UNIX machines, make sure that the ulimit for the Agent account is set properly per the Control-M/Agent pre-installation documentation:  



    Article Number:


    Article Type:

    Solutions to a Product Problem

      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles