Running administrative script files on WebSphere Application Server

You can run administrative scripts from within the development environment, without having to switch to the non-graphical command interpreter, WebSphere Application Server wsadmin tool. Use the WebSphere® Application Server Administrative Script Launcher to run administrative script files on WebSphere Application Server. To run script files within the development environment you need to specify the location of your script, the runtime environment to interpret your script, and the security settings; if your script is running against a secured server.

Before you begin

  • Define an administrative script file with the appropriate file extensions. A Jython script file requires the .py, .PY, .jy, or .JY file extension. A Jacl script file requires the file extension .jacl.
  • For running administrative scripts, the workbench requires a local installation of WebSphere Application Server, even if you are running the administrative scripts against a remote server. The reason is because the workbench uses the administrative scripting run times that are provided in the libraries of the locally installed server.
    Restriction: If the local WebSphere Application Server was installed by a root user and you attempt to run the WebSphere Application Server Administrative Script Launcher while you run the workbench with a non-root user ID, you are going to encounter a similar error message in the console view:
    !MESSAGE Error reading configuration: /opt/IBM/WAS_install_directory/profiles/unsecure/configuration/org.eclipse.osgi/.manager/.fileTableLock (Permission denied)
    !STACK 0
    java.io.FileNotFoundException: /opt/IBM/WAS_install_directory/profiles/unsecure/configuration/org.eclipse.osgi/.manager/.fileTableLock (Permission denied)
    The error occurs because the WebSphere Application Server Administrative Script Launcher attempts to write data into the WebSphere Application Server profile, which can be written to only by the root user. The non-root user does not have the correct file permissions for writing into a root profile.

    The workaround is to run the WebSphere Application Server Administrative Script Launcher with a non-root profile. You can select a non-root profile by using the Profile name list available in the WebSphere Application Server Administrative Script Launcher. For more information on creating a non-root profile, see the Creating profiles for non-root users topic available in the WebSphere Application Server documentation.

  • Start the local or remote server you want to run your administrative script file against.

About this task

Run administrative script files on WebSphere Application Server.

Procedure

  1. You can open the WebSphere Application Server Administrative Script Launcher in any of the following ways:
    • In the Servers view, right-click a WebSphere Application Server and select Administration > Run administrative script
    • Right-click on any text editor, for example the Jython editor, and select Run As > Administrative Script
    • In the Enterprise Explorer or the Navigator view, right-click a file with a valid file extension, and select Run As > Administrative Script
    • In the toolbar of the Java™ or Java EE perspective, select Run > Run Configurations > WebSphere Application Server Administrative Script and then select New launch configuration (The screen capture is of the new launch configuration button.)
  2. The Script page, is the main page of the WebSphere Application Server Administrative Script Launcher.
  3. In the Administrative Script field, complete either the following to specify the location of your script file:
    • Type the path to your script file.
    • Click Workspace to browse to your script file on your workspace.
    • Click the File System to browse to your script file on your file system.
    • Click Variables to automatically expand out the path to your script file when a resource is selected on your workspace.
  4. In the Scripting runtime environment list, select a name of an installed WebSphere Application Server runtime environment as defined in the Preferences page (Window > Preferences > Server > Runtime Environments). Specify a runtime environment that is on your local file system to interpret your script file. If the runtime environment you want to interpret your script file is not available in the drop-down list, click New to define a new WebSphere Application Server runtime environment. The New Server Runtime Environments wizard opens. Although you can create any runtime environments with the New Server Runtime Environments wizard, the WebSphere Application Server Administrative Script Launcher supports only the following local runtime environments:
    • WebSphere Application Server v6.1 or later
    As a result, the Scripting runtime environment drop-down list is going to display only the supported runtime environments.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. Click Run to run your script file.
Icon that indicates the type of topic Task topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: twsadminlauncher.html