Debugging Jython script files on WebSphere Application Server

You can detect and diagnose errors in your Jython script with the debugger. You can control the running of your script by setting breakpoints, suspending threads, stepping through the code, and examining the contents of the variables. To debug Jython scripts, use the WebSphere® Application Server Administrative Script Launcher to set up the runtime environment to interpret your script, and the security settings; if your script is running against a secured server.

Before you begin

  • For debugging administrative scripts, the workbench requires a local installation of WebSphere Application Server v6.1 or later even if you are debugging the administrative scripts against a remote server. The reason is that the workbench uses the administrative scripting runtime environments that are provided in the libraries of a locally installed server.
  • Start the local or remote server you want to debug your administrative script file against.
Restriction: WebSphere Application Server v6.1 and later is the only supported runtime environment for debugging Jython script files. However, when you run (as opposed to debugging) Jython script files, there is a different list of supported runtime environments. See Running administrative script files on WebSphere Application Server for details.
Tip: The difference between running versus debugging Jython scripts is that for debugging Jython scripts you can set breakpoints in the script; whereas in running a Jython script you are running the script without interruptions.
Restriction: To debug Jython scripts, the Jython scripts must exist within the workbench by either creating or importing the Jython script into the workbench. You must debug your Jython script within the workbench, as opposed to running a Jython script located on the file system. Debugging tools such as the breakpoint margin to set breakpoints is not available when you debug the Jython script outside the workbench on the file system.

About this task

To debug Jython scripts:

Procedure

  1. Open a Jython script file in the Jython editor:
    1. In Navigator view, expand the Jython project that contains the Jython script file you want to debug your Jython script file.
    2. Right-click the Jython script file.
    3. In the menu, select Open With > Jython Editor.
  2. Set breakpoints in the Jython script. To set one or more breakpoints in the Jython editor, double-click in the margin next to the line of code that you want to set as a breakpoint.
  3. In the Jython editor, right-click and in the menu select Debug As > Administrative script. The WebSphere Application Server Administrative Script Launcher opens. Use the WebSphere Application Server Administrative Script Launcher to debug administrative script files on WebSphere Application Server from within the development environment.
  4. The Script page, is the main page of the WebSphere Application Server Administrative Script Launcher.
  5. The Administrative Script field is automatically pre-filled with the path to your script file.
  6. In the Scripting runtime environment list, select a name of a WebSphere Application Server runtime environment as defined in the Preferences page (Window > Preferences > Server > Runtime Environments). You must specify a runtime environment that is on your local file system to interpret your script file. If the runtime environment that you want to interpret your script file is not available in the list, click New to define a new WebSphere Application Server runtime environment. The New Server Runtime Environment wizard opens. You can create any runtime environments with the New Server Runtime Environment wizard. However, when you use the WebSphere Application Server Administrative Script Launcher for debugging Jython script, only the local WebSphere Application Server v6.1 or later runtime environment is supported for debugging.
  7. In the Profile name list, select a profile that belongs to the previously selected runtime environment. A profile is the set of files that define the runtime environment. If you select the [Unspecified] option, the tool is going to choose the profile who is assigned the default role.
  8. In the wsadmin arguments field, specify advanced command-line invocation syntax for the wsadmin scripting client. A command-line invocation syntax reference is available in the WebSphere Application documentation, see Wsadmin Tool topic for more details. This WebSphere Application Server Administrative Script Launcher already handles the following information that is passed to the wsadmin scripting client:
    • The file name and path of the script file
    • The language of the script file
    • The name of the WebSphere Application Server profile that is used to run your script file
    • The user ID and password to authenticate to the targeted secured server
    Do not specify the information again in the wsadmin arguments field.

    If you are running the administrative scripts against a remote server, specify whether you are using either a remote method invocation (RMI) or SOAP connection type and its port value. If security is enabled on the remote server, specify the -user and -password parameters. Use one of the following command syntaxes in the wsadmin arguments field:

    • For SOAP connection type:
      -conntype SOAP [-host host_name] [-port port_number] [-user userid] [-password password]

      For example: -conntype SOAP -host mycomputer.mycompany.com -port 8800 -user myUserID -password myPassword

    • For RMI connection type:
      -conntype RMI [-host host_name] [-port port_number] [-user userid] [-password password]

      For example: -conntype RMI -host mycomputer.mycompany.com -port 2809 -user myUserID -password myPassword

    Tip: If you want to pass arguments to your Jython script, do not specify them in this wsadmin arguments field, as this field is target for the wsadmin scripting client. Instead, select the Arguments page and in the Program arguments text box specify your program arguments.
    Note: If you need to specify the program arguments for running your Jython scripts, keep in mind that the first program parameter is used for different purposes when debugging versus running the Jython scripts.
  9. In the Security section, specify whether your script is running against a server that is secured by selecting one of the following options.
    Option Description
    No security on target server Specifies your script is running against a server that is not secured.
    As defined in soap.client.props or sas.client.props file

    Specifies that your script is running against a secured WebSphere Application Server, and you supplied authentication information in the sas.client.props or the soap.client.props files to communicate with this secured server.

    The sas.client.props and the soap.client.props files are in the properties directory for each WebSphere Application Server profile, for example x:/profilePath/properties.

    If you use a Remote Method Invocation (RMI) connector, set values for the following properties in the sas.client.props file with the appropriate values.

    com.ibm.CORBA.loginUserid=
    com.ibm.CORBA.loginPassword=
    Also, set the following property:
    com.ibm.CORBA.loginSource=properties
    The default value for this property is prompt in the sas.client.props file. If you leave the default value, a dialog box appears with a password prompt. If the script is running unattended, it appears to hang.
    If you use a Simple Object Access Protocol (SOAP) connector, set values for the following properties in the soap.client.props file with the appropriate values:
    com.ibm.SOAP.securityEnabled=true
    com.ibm.SOAP.loginUserid=
    com.ibm.SOAP.loginPassword=
    Optionally, set the following property:
    com.ibm.SOAP.loginSource=none
    You can find the default value for this property in the soap.client.props file. If you accept the default value and do not provide loginUserid and loginPassword values, a dialog box appears with a password prompt. If the script is running unattended, it appears to hang.
    Note: If you specify user and password in the Specify section and in the sas.client.props file or the soap.client.props file, the WebSphere Application Server Administrative Script Launcher overrides the information in the .props file.
    Specify Specifies that your script is running against a server that is secured.

    In the User ID and Password fields, type the user ID and password to authenticate to this targeted secured server.

    If you specify user ID and password information in this section and in the sas.client.props file or the soap.client.props file, the WebSphere Application Server Administrative Script Launcher overrides the information in the .props file.

    Attention: The use of the password field can result in security exposure as the password information becomes visible to the system status program such as ps command, which can be started by other users to display all the running processes. Do not use this option if security exposure is a concern. Instead, select As defined in soap.client.props or sas.client props file; and specify the user ID and password information in the soap.client.props file for SOAP connector or sas.client.props file for RMI connector. The soap.client.props and sas.client.props files are in the properties directory of your WebSphere Application Server profile.
  10. Click Apply to save your configuration. The appropriate VM arguments and class paths for your selected WebSphere Application Server runtime environment are automatically populated.
    Tip: If you change your selection for the Scripting runtime environment list, click Apply for each change to automatically populate the correct VM arguments and class paths for your newly selected WebSphere Application Server runtime environment.
  11. Verify that you have breakpoints set in the Jython editor (specified in the earlier steps). Otherwise, your debug session runs to completion.
  12. Click Debug to debug your script. The Debug perspective opens.

What to do next

The debugger suspends on the set breakpoint on your Jython script, and you can further debug the script in the Debug perspective.
Icon that indicates the type of topic Task topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: tjythondebug.html