Search code examples
webspherejythonearwsadmin

How do I get that a WebSphere application has been installed in Jython?


When I deploy an .ear application in WebSphere I have a problem in installing the shared libraries. I use a workaround to solve my issue like that

  [... code to install the application]
  && sleep 60 
  && /opt/IBM/WebSphere/AppServer/bin/wsadmin.sh -lang jython -c \
    "AdminApp.edit('appname', ['-MapSharedLibForMod', [['.*','.*', 'ibm']]])"

because I need to be sure that the .ear file has been installed before calling AdminApp.edit

How can I get rid of the sleep command? Is there a way to get a signal that the app has been installed?


Solution

  • In my deploy script (bash) I call:

    #!/bin/bash
    
    $DM_WAS_HOME/wsadmin.sh -f $SCRIPTS_HOME/application_deploy.jacl $WORKING_DIRECTORY/appServer/$EAR_NAME $dmserver
    
    if [ $? -eq 0 ]
    then 
        $DM_WAS_HOME/wsadmin.sh -lang jython -f $SCRIPTS_HOME/link_shared_lib.jython
        if [ $? -ne 0 ]
        then
             echo "ERROR: could not link libraries."
             exit 2
        fi
    else
        echo "ERROR: installation failed, fix it"
        exit 1
    fi
    

    Anything goes wrong in the wsadmin.sh installation and the exit status is not 0. This way if your install takes more time for some reason, it will not be an issue, since only when the first task is done will you move on.

    The application installation jacl sets a bunch of variables and calls:

    $AdminApp update $appname app $updateopts
    $adminConfig save
    foreach nodeName $SyncNode {
        puts "Syncing $nodeName"
        $AdminControl invoke $nodeName sync
    }
    

    So anything does not work correctly in there, the exit status is != 0.
    Yes I know I have to rewrite my jacl into jython (still on WAS 7 for this application).