Wsadmin
Encyclopedia
The wsadmin tool is a command shell for the purpose of performing systems administration on all the artifacts in a IBM WebSphere Application Server (WAS) cell. It gets its name from the name of the shell script
that invokes this command shell. This command shell can execute connected to a WAS cell or completely disconnected from a WAS cell (local mode). The wsadmin tool can be used to execute scripts written in Jacl
and Jython
, or it can be used interactively to execute individual commands. These scripts and commands perform administrative tasks like application deployment, configuration changes and run-time monitoring and control of IBM WAS.
Control Program. It was used in older versions of WAS like Version 4.0 and Version 3.5. The wsadmin command shell replaced wscp in WebSphere Application Server Version 5.0 and all subsequent versions. It can perform almost all of the tasks which can be done through the browser based administrative console, and it can perform some tasks that the administrative console cannot do.
that executes wsadmin in the bin directory of WAS install root and in the bin directory of every profile. With the exception of stand alone installations of WAS, wsadmin is almost always invoked from the bin directory of the deployment manager's profile. To invoke wsadmin in interactive mode,
wsadmin [-h(help)] [-?] [-c] [-p ] [-profile ] [-profileName ] [-f ] [-javaoption java_option] [-lang language] [-wsadmin_classpath classpath] [-conntype SOAP [-host host_name] [-port port_number] [-user userid] [-password password] RMI [-host host_name] [-port port_number] [-user userid] [-password password] NONE]
*If SOAP or RMI, then give relevant host_name, port_number, userid and password.
*If NONE, then it will run in local mode.
How to enable: The Remote mode is connected through TCP
network connection while the Local mode does not need TCP connection. Advantages:
Remote mode: It can be accessed from the same or other LPAR
. Two Remote mode clients will never face conflict. Their respective changes will be intellectually handled by the IBM WAS. Local mode: It would not have any problems related to SSL certificates. It can work even when the server is down.
Disadvantages:
Remote mode: The IBM WAS must not be in down status. There may be an issue of SSL certifications conflict.
Local mode: It will not work efficiently with multiple access because in the multiple access through Local mode the synchronization of changes may create a serious issue. The Local mode is weaker than Remote mode in respect of the security.
/Java EE or C
programmer may be more comfortable with Jython whereas Tcl
experts may prefer Jacl. Though the script syntax is different, Jacl and Jython are equally powerful. The IBM Jacl to Jython Conversion Assistant program is used to convert wsadmin Jacl scripts into Jython.
The other way is, to change default language as the Jython instead of Jacl.
To change default language, consider the following steps: (It is for Unix
based systems.)FTP that modified file and the changing default language is completed.
Keep in mind that this method would change scripting language permanently to Jython.
Multiple nested statements inside [] cannot directly be used unless assigned to a variable
print statements are needed to interpret and/or convert formatting of output
Shell script
A shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language...
that invokes this command shell. This command shell can execute connected to a WAS cell or completely disconnected from a WAS cell (local mode). The wsadmin tool can be used to execute scripts written in Jacl
Tcl/Java
Tcl/Java is a project to bridge Tcl and Java.It consists of two distinct packages, Tcl Blend and Jacl.-Tcl Blend:Tcl Blend is a Tcl extension that makes use of JNI to facilitate communication between a Java interpreter and a Tcl interpreter...
and Jython
Jython
Jython, successor of JPython, is an implementation of the Python programming language written in Java.-Overview:Jython programs can seamlessly import and use any Java class. Except for some standard modules, Jython programs use Java classes instead of Python modules...
, or it can be used interactively to execute individual commands. These scripts and commands perform administrative tasks like application deployment, configuration changes and run-time monitoring and control of IBM WAS.
History of WebSphere Application Server command shells
The wscp stands for WebSphereWebSphere
IBM WebSphere refers to a brand of computer software products in the genre of enterprise software known as "application and integration middleware". These software products are used by end-users to create applications and integrate applications with other applications...
Control Program. It was used in older versions of WAS like Version 4.0 and Version 3.5. The wsadmin command shell replaced wscp in WebSphere Application Server Version 5.0 and all subsequent versions. It can perform almost all of the tasks which can be done through the browser based administrative console, and it can perform some tasks that the administrative console cannot do.
Invoking wsadmin
There is a copy of the shell scriptShell script
A shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language...
that executes wsadmin in the bin directory of WAS install root and in the bin directory of every profile. With the exception of stand alone installations of WAS, wsadmin is almost always invoked from the bin directory of the deployment manager's profile. To invoke wsadmin in interactive mode,
- Open the command line window of the machine in which IBM WebSphere Application Server is already installed.
- Change directory to:
/bin/ (This will almost always be the bin directory of the deployment manager's profile) - Execute the file named wsadmin.[sh |bat] . See invocation syntax for available options.
- You will see a wsadmin command line. Any commands you type will execute immediately. If you make configuration changes, those changes will not take effect unless you invoke the save command of the AdminConfig script object.
Invocation syntax
After invocation of wsadmin the command-line window will show the following text:wsadmin [-h(help)] [-?] [-c
Options
The text written between squared brackets ([...]) are called options of the wsadmin tool.*If SOAP or RMI, then give relevant host_name, port_number, userid and password.
*If NONE, then it will run in local mode.
Five script objects of
wsadmin Five script objects provide the commands that administrators execute to perform various administrative operations. Two of these - AdminControl and AdminConfig - are primitive objects. Two others - AdminApp, AdminTask - provide a more high level interface for administrative tasks. The final script object - Help - provides several different forms of help.Two Modes of
wsadmin The wsadmin could be operated by two modes; a Remote mode and a Local mode.- Use: The
Transmission Control Protocol
The Transmission Control Protocol is one of the core protocols of the Internet Protocol Suite. TCP is one of the two original components of the suite, complementing the Internet Protocol , and therefore the entire suite is commonly referred to as TCP/IP...
network connection while the Local mode does not need TCP connection.
LPAR
A logical partition, commonly called an LPAR, is a subset of computer's hardware resources, virtualized as a separate computer. In effect, a physical machine can be partitioned into multiple logical partitions, each hosting a separate operating system....
. Two Remote mode clients will never face conflict. Their respective changes will be intellectually handled by the IBM WAS.
Scripting languages: Jacl and Jython
The wsadmin supports Jacl (an alternate implementation of TCL written in Java) and Jython (Java, Python) scripting languages. The choice of Jacl or Jython may depend on the programmer's comfortability. The JavaJava (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
/Java EE or C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
programmer may be more comfortable with Jython whereas Tcl
Tcl
Tcl is a scripting language created by John Ousterhout. Originally "born out of frustration", according to the author, with programmers devising their own languages intended to be embedded into applications, Tcl gained acceptance on its own...
experts may prefer Jacl. Though the script syntax is different, Jacl and Jython are equally powerful. The IBM Jacl to Jython Conversion Assistant program is used to convert wsadmin Jacl scripts into Jython.
Changing default language
In IBM WebSphere Application Server Version 6.1, the Jacl is deprecated. To use Jython as the scripting language, either of the two following ways.- You may mention Jython in the option
To change default language, consider the following steps: (It is for Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
based systems.)
- Be in the following directory:
/DeploymentManager/profiles/properties - Edit the file wsadmin.properties
- open it and you will find:
Basic difference between Jacl and Jython syntaxes
Here, five basic commands (for getting help for the relevant objects) are written in their particular syntaxes. The case-sensitiveness in the scripting must be the crucial thing to be taken care of.Jacl | Jython |
---|---|
$Help help | print Help.help |
$AdminConfig help | print AdminConfig.help |
$AdminTask help | print AdminTask.help |
$AdminControl help | print AdminControl.help |
$AdminApp help | print AdminApp.help |
Points to keep in mind
- The case-sensitiveness of the script syntax.
- It is a good practice to assign commands in a script and run that script using wsadmin -f
rathen than running each commands individually using wsadmin -c . So, prefer wsadmin -f to get faster execution. - Any configuration changes that your scripts make will not take effect until you commit those changes. Use the command, AdminConfig.save (If Jython is used.) or $AdminConfig save (If Jacl is used.), to make your configuration changes permanent.
Tips / Gotchas / Limitations in wsadmin
- Jacl behaviour
Multiple nested statements inside [] cannot directly be used unless assigned to a variable
- Jython behaviour
print statements are needed to interpret and/or convert formatting of output