Tuesday 27 March 2012

Execution Phases of wsadmin


The Java Virtual Machine Initialization Phase

The wsadmin program is written in Java. It requires a Java Virtual Machine (JVM) in order to execute.

-javaoption <java_option>

This option allows values to be provided that define how the JVM should be initialized. Any valid JVM option may be included. For example, to define the maximum size to be used by the Java heap, one can use something like -javaoption -Xmx1024m.

-wsadmin_classpath <classpath>

This option should be used to add Java class files to the classpath. Multiple entries should be separated using a semicolon. Should a space exist in any of the directory names, surround the entire value in double quotes.

-wsadmin_classpath “C:/Program Files/classes/myClasses.jar”

The wsadmin Environment Initialization Phase

The next category of options is related to the tailoring of the wsadmin environment, which in
many ways is an extension of the settings used to configure the JVM environment.

 -p <properties_file_name>

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 product properties directory(D:\IBM\WebSphere\AppServer\properties). The second level is the user default, wsadmin.properties, which is located in your home (D:\IBM\WebSphere\wp_profile\properties) directory. The third level is the properties file to which the environment variable WSADMIN_PROPERTIES references.


The Connection Phase

After all of the wsadmin environment property values have been loaded, the next phase of the initialization can take place. This is when wsadmin uses the connection type value to determine whether a connection to an application server should be attempted. If not, that is, should -conntype none be specified on the command line or in the property file(s), wsadmin initialization does not attempt to connect to an application server and could be used to view and manipulate the application server configuration details. When wsadmin is not connected to an application server, it is called being in local mode.

Conntype types include: SOAP, RMI, JSR160RMI, IPC and NONE. For each connection type, you can specify additional attributes about the connection.

For the SOAP connection type, you can specify the following attributes:
Table 1. -conntype SOAP connection type attribute descriptions. Use this attribute to specify a SOAP connection type.
Attribute
Description
[-host host_name]
Specifies the host name for the connection. The default is the local host.
[-port port_number]
Specifies the port number for the connection.
[-user userid]
Specifies the user ID to use to establish the connection.
[-password password]
Specifies the password to use to establish the connection.

For the RMI connection type, you can specify the following attributes:
Table 2. -conntype RMI connection type attribute descriptions. Use this attribute to specify an RMI connection type.
Attribute
Description
[-host host_name]
Specifies the host name for the connection. The default is the local host.
[-port port_number]
Specifies the port number for the connection.
[-user userid]
Specifies the user ID to use to establish the connection.
[-password password]
Specifies the password to use to establish the connection.

For the JSR160RMI connection type, you can specify the following attributes:
Table 3. -conntype JSR160RMI connection type attribute descriptions. Use this attribute to specify a JSR160RMI connection type.
Attribute
Description
[-host host_name]
Specifies the host name for the connection.
[-port port_number]
Specifies the port number for the connection.
[-user userid]
Specifies the user ID to use to establish the connection.
[-password password]
Specifies the password to use to establish the connection.

For the IPC connection type, you can specify the following attributes:
Table 4. -conntype IPC connection type attribute descriptions. Use this attribute to specify an IPC connection type.
Attribute
Description
[-ipchost host_name]
Specifies the host name for the connection. This attribute overrides the host name specified for the com.ibm.ws.scripting.ipchost property in the wsadmin.properties properties file.
[-port port_number]
Specifies the port number for the connection.
[-user userid]
Specifies the user ID to use to establish the connection.
[-password password]
Specifies the password to use to establish the connection.


Defining the Scripting Language

After the connection phase, the environment initialization phase determines the scripting language using the –lang option (from either a wsadmin.properties file or a command line option).

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, then 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, then an error message is generated.

Trace-Related Options

Another of the things that can be controlled about the environment initialization is related to tracing.

Three command-line options exist that relate to tracing of wsadmin:
• tracefile
• appendtrace
• jobid

The first two of these have corresponding settings in wsadmin.properties (for example,
traceFile and appendTrace). The other (-jobid) is only available as a command-line option
and is used to add a text string to the wsadmin trace file. This entry can be used to correlate the contents of the trace file with a specific invocation of wsadmin. If the jobid text string contains spaces, then the string should be enclosed in quotation marks:

wsadmin -jobid “Ports used” -f ListPorts.py

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) is displayed 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 default value is false.

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

wsadmin -jobid wsadmin_test_1 -tracefile c:/temp/wsadmin_test_1.log -appendtrace true

No comments:

Post a Comment