Search code examples
webspherewebsphere-8wsadminjacl

Jacl - What is the proper syntax for variable use in an option specifier


In attempting to run the following command in a Jacl script (with $APPNAME having been set prior to this call):

$AdminApp install $EARFILE {-nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -verbose -appname $APPNAME -createMBeansForResources -noreloadEnabled ...}

I get the following error.

WASX7017E: Exception received while running file "deploy_myk.jacl"; exception information: com.ibm.ws.scripting.ScriptingException: WASX7108E: Invalid data specified for install task: "AppDeploymentOptions."  
Errors are: 
"ADMA0085E: A validation error occurred in task Specifying application options. Application name, $APPNAME, is not valid.
 An application name cannot begin with a dot, cannot have leading or trailing spaces, cannot contain "]]>", and cannot contain any of the following characters:  \ / , # $ @ : ; " * ? < > | = + & % '"

I seem unable to find the docs that shed light on the use of script variables within an 'option' specifier string. Clearly there must be some way to do what I'm trying to do, which is deploy an EAR file with a name of my choosing at the time the script is run


Solution

  • Jacl/Tcl is a string-based language, and the {} delimiter prevents variable interpolation, similar to '' in UNIX shell programming. You want something like:

    $AdminApp install $EARFILE "-nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -verbose -appname $APPNAME -createMBeansForResources -noreloadEnabled ..."
    

    ...or:

    $AdminApp install $EARFILE [list -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -verbose -appname $APPNAME -createMBeansForResources -noreloadEnabled ...]
    

    This Tcl tutorial might be of interest, particularly the "Evaluation & Substitutions" section.

    Alternatively, you could avoid the complexities of Jacl strings by switching to -lang jython.