How to - Installing Content Script Online Debugger (with video)

How to - Installing Content Script Online Debugger (with video)

Objective

With Module Suite, is it possible open a debugger for the Content Scripts: this debugger allow to add breakpoints in the scripts and perform an execution step by step, evaluating the values of the viriables.
This debugger uses the default options provided by the Java Virtual Machine.

Software version

This is valid for all the product versions
The debugger tool is available only for Windows environments.

Preparation

The first step it is install the debug extension, running the Module Suite setup (http://developer.answermodules.com/manuals/current/installation/extpacks/) and selecting the right package


Before start these steps, check on OpenText official documentation the JDK embedded with Content Script. Versions older than 16.2.8 embed Java8 (or lower). Versions from 16.2.8 embed OpenJDK11.
In order to enable the Content Script debugger, please follow these steps:
  1. Stop Content Server instance
  2. Only for Java8 or lower copy the tools.jar from a Java JDK installation to the amlib/amdebug folder in the anscontentscript module
  3. Enable JVM debugging in opentext.ini file, adding the the following line in the [javaserver] section (please replace X with the first free number in the sequence of the Java Options already in the file)
    1. JavaVMOption_1X=-Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=cssharedmemory for Java8 (or lower)
    2. JavaVMOption_1X=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:9009 for OpenJDK11
  4. Start your Content Server instance
  5. For version that uses OpenJDK version, in Base Configuration set the properties in this way (for older versions keep the default ones)

  1. Configure an additional object menu entry for Content Script objects (http://developer.answermodules.com/manuals/current/working/classicui/amgui/#customize-an-objects-functions-menu-csmenu):
    1. In the Content Script Volume, open the CSMenu folder
    2. Create a new Template Folder with name S43200. This is the typeid of the Content Scripts and this will enable the additional menu for this type of objects.
    3. In the folder created at previous step, add a Content Script object with the following body
  1. menu = amgui.getCSMenu().appendItem("Debug", "${url}?func=amcs.executeadmcs&script=debug.cs&csnode=${nodeID}",true, 0)
  2. amgui.returnCSMenu(menu)

Execution

This video shows the steps listed in previous section and show also how to use the debugger