Search code examples
javawebspherejythonwebsphere-8wsadmin

Get module versions through wsadmin (WAS 8.5)


How can I get the version of a specific module in a deployed application on a WebSphere 8.5 server?

I tried the following commands.

Get all installed applications:

wsadmin> $AdminApp list
MyApplicationEAR

Get version of this application (MyApplicationEAR):

wsadmin> $AdminApp view MyApplicationEAR -buildVersion
Build-ID of application:  SNAPSHOT_17-07-2014_16-33-28_rev_123

List all modules of this application:

wsadmin> $AdminApp listModules MyApplicationEAR
MyApplicationEAR#MyApplicationWeb.war+WEB-INF/web.xml
MyApplicationEAR#Toolbox.war+WEB-INF/web.xml

Get version of one module (MyApplicationWeb.war):

$AdminApp view MyApplicationEAR#MyApplicationWeb.war+WEB-INF/web.xml -buildVersion
WASX7015E: Exception while executing command: "$AdminApp view MyApplicationEAR#MyApplicationWeb.war+WEB-INF/web.xml -buildVersion". Exceptioninfo:
com.ibm.ws.scripting.ScriptingException: WASX7406E: The taskname buildVersion was not found in the application MyApplicationEAR.

But if I open the WebSphere admin console GUI (localhost:xxxx/ibm/console) and go to:

Applications >
  Application Types >
    WebSphere enterprise applications >
      MyApplicationEAR >
        MyApplicationEAR >
          Display module build IDs

I can see the own versions of all modules.

The version of the EAR is stored like the version of each module in the META-INF/MANIFEST.MF under Implementation-Version: XXX.

Has somebody a hint, how to get these module versions with wsadmin (or with the Java AdminClient API)?


Solution

  • If you will just run the view command for the module, like $AdminApp view MyAppTestEAR#MyAppTest.war+WEB-INF/web.xml, at the end of the output you will find Build ID: 1.1

    wsadmin>$AdminApp view MyAppTestEAR#MyAppTest.war+WEB-INF/web.xml
    MapModulesToServers: Selecting servers
    
    Specify targets such as application servers or clusters of application servers
    here you want to install the modules that are contained in your application. Mo
    ules can be installed on the same application server or dispersed among several
    application servers.
    Also, specify the Web servers as targets that serve as routers for requests to
    his application.
    The plug-in configuration file (plugin-cfg.xml) for each Web server is generate
    , based on the applications that are routed through.
    
    Module:  MyAppTest
    URI:  MyAppTest.war,WEB-INF/web.xml
    Server:  WebSphere:cell=rad9vmNode02Cell,node=rad9vmNode02,server=server1
    
    ....  // cut off irrelevant output for short
    
    
    ModuleBuildID: Module Build ID
    
    Display module build IDs.
    
    Module:  MyAppTest
    URI:  MyAppTest.war,WEB-INF/web.xml
    Build ID:  1.1
    wsadmin>
    

    UPDATE
    You can actually run it on your application, you don't have to specify module:

    wsadmin>$AdminApp view MyAppTestEAR -ModuleBuildID
    ModuleBuildID: Module Build ID
    
    Display module build IDs.
    
    Module:  MyAppTest
    URI:  MyAppTest.war,WEB-INF/web.xml
    Build ID:  1.1
    

    and to get available options you can run -tasknames

    wsadmin>$AdminApp view MyAppTestEAR -tasknames
    CustomActivationPlan
    MetadataCompleteForModules
    JSPReloadForWebMod
    MapWebModToVH
    SharedLibRelationship
    AppDeploymentOptions
    MapJaspiProvider
    MapModulesToServers
    MapResEnvRefToRes
    ModuleBuildID
    MapSharedLibForMod
    CtxRootForWebMod