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
Was this topic helpful?
Document Information
Modified date:
15 June 2018
UID
swg21232465