Monday, June 27, 2011

Saving large EAR files

Things have been quiet here at 'wsadminlib central' lately, since many contributors have been focused on getting WAS V8 out the door.  Now that WAS V8 has shipped, here is a brief update...

Frequent wsadminlib contributor Chris in Australia reported a problem saving a large EAR file, on the order of 300 Mb.  He had trouble starting the application immediately after doing a save and sync.  He also observed that the file system was still growing for a short time after the sync.

Now I always thought that an application was fully deployed and ready to start when wsadminlib's method saveAndSync() returned, but not true...

After some experimenting and research, we learned that WAS continues to expand the EAR file into specific directories after the sync is complete.  And we also learned a way to query when it is done.

AdminApp.isAppReady() will report whether an EAR is fully expanded and ready to start.

The following helper method encapsulates the call to AdminApp.  This method returns a boolean value (0 or 1) which is easy for your code to test, whereas the underlying method returns a string 'true'.  This method may be added to your copy of or used in your own scripts.

def isApplicationReady(appname):
    """Returns True when app deployment is complete and ready to start.
       Returns False when the app is not ready or is not recognized.
       This method indicates when background processing is complete
       following an install, save, and sync.   
       This method is useful when installing really large EARs."""
    m = "isApplicationReady:"
    rc = False
        if 'true' == AdminApp.isAppReady(appname):
            sop(m,"App %s is READY. Returning True." % (appname))
            rc = True
            sop(m,"App %s is NOT ready. Returning False." % (appname))
        sop(m,"App %s is UNKNOWN. Returning False." % (appname))
    return rc
If you find this useful, we will include it in the next version of  We can also include a method which waits until the app is ready (up to a timeout value).  Please let us know.