简体   繁体   中英

How to set a string value containing spaces into MapWebModToVH when using wsadmin

Currently I am trying to deploy an EAR file with wsadmin.sh. Using the following command:

wsadmin.sh -lang jython -conntype NONE -c "AdminApp.install('/tmp/Sample1.ear', '[ -appname Sample1 -contextroot /Sample1 -MapWebModToVH [[ Sample1 Sample1.war,WEB-INF/web.xml default_host]]]')"

However,

WASX7015E: Exception running command: "AdminApp.install('/tmp/sample1.ear', '[ -appname Sample1 -contextroot /Sample1 -MapWebModToVH [[ Sample1.war
 Sample1.war,WEB-INF/web.xml default_host]]]')"; exception information:
com.ibm.ws.scripting.ScriptingException: WASX7111E: Cannot find a match for supp
lied option: "[Sample1, Sample1.war,WEB-INF/web.xml, default_host]" for task
 "MapWebModToVH". The supplied option must match with the existing task data in
the application and the existing task data are: "["Sample Web Application" Sample1.war,WEB-INF/web.xml] "

Apparently the -MapWebModToVH should encorporate "Sample Web Application" as first value and not Sample1, but how should we do this since the parameters are seperated by a space. Using "Sample Web Application" as value with quotes does noet work. What is going wrong?

Use double quotes to enclose spaces within the single-quote-delimited string.

Since the outer string is delimited by single quotes, you can use double quotes within the quoted string value. (This is a feature of Python in general). Eg:

AdminApp.install('/tmp/Sample1.ear', '[ -appname Sample1 -contextroot /Sample1 -MapWebModToVH [[ "Sample Web Application" Sample1.war,WEB-INF/web.xml default_host]]]')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM