Wsadmin tool

The WebSphere Application Server wsadmin tool runs scripts. You can use the wsadmin tool to manage WebSphere Application Server as well as the configuration, application deployment, and server run-time operations.

[z/OS] You can run wsadmin commands from WebSphere Application Server on a distributed platform and use that distributed command to administer WebSphere Application Server on a z/OS platform.

The options for the wsadmin tool are case insensitive.

Important: All users who run commands from a specific profile must have authority to modify files that are created by other users that use the same profile. Otherwise, you might see a permission denied error in the log files. To avoid this issue, consider one of the following policies:
  • [AIX HP-UX Linux Solaris Windows] [iSeries] Use specific profiles for distinct user authorities
  • [z/OS] Use a separate installation for distinct user authorities
  • Always use the same user for all of the commands that are run in a given profile
  • Ensure that all users of a specific profile belong to the same group. In addition, ensure that each user of a group has the read and write authority to the files that are created by other members in the same profile.

Do not pass in empty strings in place of command options. The wsadmin tool displays general help information if you specify an empty string as the command option. Use the following command-line invocation syntax for the wsadmin scripting client:

[AIX HP-UX Linux Solaris Windows] [iSeries]
wsadmin [-h(help)] 

[-?] 

[-c <commands>] 

[-p <properties_file_name>] 

[-profile <profile_script_name>] 

[-profileName <profile_name>]

[-f <script_file_name>] 

[-javaoption java_option]

[-lang language] 

[-wsadmin_classpath classpath]

[-conntype SOAP [-host host_name] 

	  [-port port_number] [-user userid] [-password password] | 

[-conntype RMI [-host host_name]

    [-port port_number] [-user userid] [-password password] | NONE]
[AIX HP-UX Linux Solaris Windows] [iSeries]
[-jobid string] 

[-tracefile trace_file]

[-appendtrace true/false]
[AIX HP-UX Linux Solaris Windows] [iSeries]
[script parameters] 
[z/OS]
wsadmin.sh [-h(help)] 

[-?] 

[-c <commands>] 

[-p <properties_file_name>] 

[-profile <profile_script_name>] 

[-profileName <profile_name>]

[-f <script_file_name>] 

[-javaoption java_option]

[-lang language] 

[-wsadmin_classpath classpath]

[-conntype SOAP [-host host_name] 

   [-port port_number] [-user userid] [-password password] | 

[-conntype RMI [-host host_name]

   [-port port_number] [-user userid] [-password password] | NONE]
[z/OS]
[-jobid string] 

[-tracefile trace_file]

[-appendtrace true/false]
[z/OS]
[script parameters]

Where script parameters represent any arguments other than the ones listed previously. The argc variable contains the number of arguments, and the argv variable contains a list of arguments in the order that they were coded.

Options

-c
Designates to run a single command. Multiple -c options can exist on the command line. They run in the order that you designate.
If you invoke the wsadmin tool with the -c option, any changes that you make to the configuration will be saved automatically. If you make configuration changes and you are not using the -c option, you must use the save command of the AdminConfig object to save the changes. See the Saving configuration changes with the wsadmin tool article for more information.
-f
Designates a script to run.

Only one -f option can exist on the command line.

-javaoption
Specifies a valid Java standard or a non-standard option. Multiple -javaoption options can exist on the command line.

To shorten the length of the command, type it the following way:

[AIX HP-UX Linux Solaris Windows] [iSeries]
wsadmin -javaoption "java_option java_option"
[z/OS]
wsadmin.sh -javaoption "java_option java_option"
instead of the following:
[AIX HP-UX Linux Solaris Windows] [iSeries]
wsadmin -javaoption java_option -javaoption java_option
[z/OS]
wsadmin.sh -javaoption java_option -javaoption java_option
-lang
Specifies the language of the script file, the command, or an interactive shell. The possible languages include: Jacl and Jython. The options for the -lang argument include: jacl and jython.

This option overrides language determinations that are based on a script file name, a profile script file name, or the com.ibm.ws.scripting.defaultLang property. The -lang argument has no default value.

If you do not specify the -lang argument but you have the -f <script_file_name> argument specified, the wsadmin tool determines the language based on a target script file name. If you do not specify the -lang argument and the -f argument, the wsadmin tool determines the language based on a profile script file name if the -profile <profile_script_name> argument is specified. If the command line or the property does not supply the script language, and the wsadmin tool cannot determine it, an error message generates.

-p
Specifies a properties file.

The file listed after -p, represents a Java properties file that the scripting process reads. Three levels of default properties files load before the properties file that you specify on the command line. The first level is the installation default, wsadmin.properties, which is located in the WebSphere Application Server properties directory. The second level is the user default, wsadmin.properties, which is located in your home directory. The third level is the properties file that the environment variable WSADMIN_PROPERTIES points to.

Multiple -p options can exist on the command line. They invoke in the order that you supply them.

You can also use the com.ibm.ws.scripting.noechoParamNo custom property with this option. This custom property enables you to specify script parameters that you not want to be visible in a trace file or standard output. To enable this custom property, create a text file such as noecho.prop. In this text file, specify positions within your wsadmin command that contains sensitive data, such as passwords, which do not want to see in a trace file or standard output. The text file can contain a single number or multiple parameter numbers that are separated by a comma. For example, the text file might contain the following information:
com.ibm.ws.scripting.noechoParamNo=3,5
When you reference this text file in your wsadmin command, the third and fifth parameter values do not show in a trace file or standard output. To use the custom property, run the wsadmin command and pass the text file with the -p option. For example:
Using Jacl:
wsadmin -f script_file script_arguments -p text_file
Using Jython:
wsadmin -lang jython -f script_file script_arguments -p text_file
For example:
wsadmin -f c:/text.py server1 dbuser dbpassword user1 userpassword -p c:/noecho.prop
[z/OS] [iSeries]
wsadmin -f text.py server1 dbuser dbpassword user1 userpassword -p noecho.prop
[AIX] [HP-UX] [Linux] [Solaris]
wsadmin -f c:\text.py server1 dbuser dbpassword user1 userpassword -p c:\noecho.prop
where dbpassword and userpassword are the third and fifth parameters that are not visible in a trace file or standard output.
-profile
Specifies a profile script.

The profile script runs before other commands, or scripts. If you specify -c, the profile script runs before it invokes this command. If you specify -f, the profile script runs before it runs the script. In interactive mode, you can use the profile script to perform any standard initialization that you want. You can specify multiple -profile options on the command line, and they invoke in the order that you supply them.

-profileName
Specifies the profile from which the wsadmin tool will run. Specify this option if one the following reasons apply:
  • You run the wsadmin tool from the WAS_HOME/bin directory and you do not have a default profile or you want to run in a profile other than the default profile.
  • You are currently in a profile bin directory but want to run the wsadmin tool from a different profile.
    Note: WebSphere Application Server for z/OS does not support user-created profiles; only the default profile is used.
-?
Provides syntax help.
-help
Provides syntax help.
-conntype
Specifies the type of connection to use.

This argument consists of a string that determines the type, for example, SOAP, and the options that are specific to that connection type. Possible types include: SOAP, RMI, and NONE.

[z/OS] The options SOAP and RMI for the -conntype argument also include: host, port, user, and password.

Use the -conntype NONE option to run in local mode. The result is that the scripting client is not connected to a running server. You can manage server configuration, the installation and the uninstallation of applications without the application server running.

-wsadmin_classpath
Use this option to make additional classes available to your scripting process.

Follow this option with a class path string. For example:

[AIX HP-UX Linux Solaris Windows]
c:/MyDir/Myjar.jar;d:/yourdir/yourdir.jar
[z/OS]
/MyDir/Myjar.jar;/yourdir/yourdir.jar
[iSeries]
/home/MyDir/Myjar.jar;/yourdir/yourdir.jar

The class path is then added to the class loader for the scripting process.

You can also specify this option in a properties file that is used by the wsadmin tool. The property is com.ibm.ws.scripting.classpath. If you specify -wsadmin_classpath on the command line, the value of this property overrides any value that is specified in a properties file. The class path property and the command-line options are not concatenated.

Avoid trouble Avoid trouble: [Updated in October 2011] The class path to set up Jython has to be specified in wsadmin.bat/sh for loading by the JDK class loader. [Updated in October 2011]
oct2011
gotcha
-host
Specify a hostname to which wsadmin should attempt to connect. The default wsadmin.properties file located in the properties directory of each WebSphere profile provides localhost as the value of the host property if this option is not specified.
-password
Specify a password to be used by the connector to connect to the server if security is enabled in the server.

Warning: The use of -password option may result in security exposure as the password information becomes visible to the system status program such as ps command which can be invoked by other user to display all the running processes. Do not use this option if security exposure is a concern. Instead, specify user 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 located in the properties directory of your WebSphere profile.

-user or -username
Specify a user name to be used by the connector to connect to the server if security is enabled in the server.
-port
Specify a port to be used by the connector. The default wsadmin.properties file located in the properties directory of each WebSphere Application Server profile provides a value in the port property to connect to the local server.
-jobid
Specifies a jobID string so that you can keep track of each invocation of the wsadmin tool for auditing purposes. The jobID string (jobID=xxxx) displays at the beginning of the wsadmin log file.
-tracefile
Specifies the name of the log file and location where the log output is directed. This option overrides the com.ibm.ws.scripting.traceFile property in the wsadmin.properties file.
-appendtrace
Determines if a trace appends to or overrides the end of the existing log file. Specify true to append the trace to the end of a log file or specify false to override the log file for each wsadmin invocation.

The following example specifies the jobID option, log location and appends the trace to the log file.

[AIX HP-UX Linux Solaris Windows]
wsadmin -jobid wsadmin_test_1 -tracefile c:/temp/wsadmin_test_1.log -appendtrace true
[z/OS] [iSeries]
wsadmin -jobid wsadmin_test_1 -tracefile /temp/wsadmin_test_1.log -appendtrace true

Example

In the following syntax examples, mymachine is the name of the host in the wsadmin.properties file that is specified by the com.ibm.ws.scripting.port property:

SOAP connection to the local host
Use the options that are defined in the wsadmin.properties file.
SOAP connection to the mymachine host
Using Jacl:
[AIX HP-UX Linux Solaris Windows] [iSeries]
wsadmin -f test1.jacl -profile setup.jacl -conntype SOAP 
-port mymachinesoapportnumber -host mymachine
[z/OS]
wsadmin.sh -f test1.jacl -profile setup.jacl -conntype SOAP 
-port mymachinesoapportnumber -host mymachine

Using Jython:

[AIX HP-UX Linux Solaris Windows] [iSeries]
wsadmin -lang jython -f  test1.py -profile setup.py -conntype 
SOAP -port mymachinesoapportnumber -host mymachine
[z/OS]
wsadmin.sh -lang jython -f  test1.py -profile setup.py -conntype 
SOAP -port mymachinesoapportnumber -host mymachine
Initial and maximum Java heap size
Avoid trouble [z/OS] [AIX HP-UX Solaris] Avoid trouble: wsadmin.sh contains a PERF_JVM_OPTIONS variable that sets default maximum and minimum heap sizes. This variable overrides any value that you specify for -javaoption in a wsadmin.sh command. To enable options specified on wsadmin.sh commands to override these default values, modify the wsadmin.sh file such that the $PERF_JVM_OPTIONS statement is encountered before the $javaOption statement.

The following example illustrates what the initial lines of code in the wsadmin.sh file should look like after you change the order of the $PERF_JVM_OPTIONS and $javaOption statements:

"$JAVA_HOME/bin/java" \
  -Xbootclasspath/p:"$WAS_BOOTCLASSPATH" \
  $EXTRA_X_ARGS \
  $CONSOLE_ENCODING \
  $PERF_JVM_OPTIONS \
  $javaOption \
  $WAS_DEBUG \
  "$CLIENTSAS" \

  ...  

$SHELL "${nonJavaOption[@]}"

After you make this change to the wsadmin.sh file, you can use commands, similar to the following commands, to change your maximum and minimum heap sizes.

gotcha

Using Jacl:

[AIX HP-UX Linux Solaris Windows] [iSeries]
wsadmin -javaoption -Xms128m -Xmx256m -f test.jacl
[z/OS]
wsadmin.sh -javaoption -Xms128m -Xmx256m -f test.jacl

Using Jython:

[AIX HP-UX Linux Solaris Windows] [iSeries]
wsadmin -lang jython -javaoption -Xms128m -Xmx256m -f test.py
[z/OS]
wsadmin.sh -lang jython -javaoption -Xms128m -Xmx256m -f test.py
RMI connection with security
Using Jacl:
[AIX HP-UX Linux Solaris Windows] [iSeries]
wsadmin -conntype RMI -port  rmiportnumber -user userid 
-password password
[z/OS]
wsadmin.sh -conntype RMI -port  rmiportnumber -user userid 
-password password

Using Jython:

[AIX HP-UX Linux Solaris Windows] [iSeries]
wsadmin -lang jython -conntype RMI -port  rmiportnumber -user userid 
-password password
[z/OS]
wsadmin.sh -lang jython -conntype RMI -port  rmiportnumber -user userid 
-password password

rmiportnumber for your connection is displayed in the Administrative Console as BOOTSTRAP_ADDRESS.

Warning: The use of -password option may result in security exposure as the password information becomes visible to the system status program such as ps command which can be invoked by other user to display all the running processes. Do not use this option if security exposure is a concern. Instead, specify user 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 located in the properties directory of your WebSphere profile.

Local mode of operation to perform a single command
Using Jacl:
[AIX HP-UX Linux Solaris Windows] [iSeries]
wsadmin -conntype NONE -c "$AdminApp uninstall app"
[z/OS]
wsadmin.sh -conntype NONE -c "\$AdminApp uninstall app"
or
wsadmin.sh -conntype NONE -c '$AdminApp uninstall app'

Using Jython:

[AIX HP-UX Linux Solaris Windows] [iSeries]
wsadmin -lang jython -conntype NONE -c "AdminApp.uninstall('app')"
[z/OS]
wsadmin.sh -lang jython -conntype NONE -c "\AdminApp.uninstall('app')"
or
wsadmin.sh -lang jython -conntype NONE -c 'AdminApp.uninstall('app')'



Subtopics
wsadmin tool performance tips
Related tasks
Starting the wsadmin scripting client
Reference topic Reference topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Aug 31, 2013 1:23:07 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=pix&product=was-nd-dist&topic=rxml_commandline
File name: rxml_commandline.html