IBM Support

Cannot start or stop application with space in name

Troubleshooting


Problem

Cannot start or stop an application from wsadmin when the display name contains a space.

Cause

The standard way to stop an application within wsadmin is the following commands:


wsadmin> set appManager [$AdminControl queryNames cell=MyCell, node=MyNode,type=ApplicationManager,process=server1,*] wsadmin> $AdminControl invoke $appManager stopApplication MyApp


However, if the application name has a space in it, for example, My App, then wsadmin will interpret that as two parameters being supplied instead of one, even if you include the name in quotes.


wsadmin>$AdminControl invoke $appManager stopApplication "My App"

WASX7015E: Exception running command: "$AdminControl invoke $appManager stopApplication "My App""; exception information:com.ibm.ws.scripting.ScriptingException: WASX7139E: Operation "stopApplication" has versions that take one of the following number of parameters: 1; 2 parameters were supplied: "My App."                    

Resolving The Problem

To resolve this issue, you must surround the application name in curly braces { }.


wsadmin> $AdminControl invoke $appManager stopApplication {"My App"}

If you prefer to use a variable, use curly braces { } to surround the variable:

wsadmin> set myapp {"My Test"}
"My Test"
wsadmin> $AdminControl invoke $appManager stopApplication $myapp


If you are following the InfoCenter instructions for performing a start or stop on all applications, this approach will not work, as in the following example:


foreach app $apps
set appName [$AdminControl getAttribute $app name]
$AdminControl invoke $appManager stopApplication $appName


To resolve this issue, implement an "if" statement to check for a space in the application name:


foreach app $apps
set appName [$AdminControl getAttribute $app name]
if {[string first " " $appName] > -1} {
 set appName "\"$appName\""
}

$AdminControl invoke $appManager stopApplication $appName

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Administrative Scripting Tools (for example: wsadmin or ANT)","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"8.5.5;8.5;8.0;7.0;6.1","Edition":"Base;Express;Network Deployment","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Java SDK","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21232465