2

如何获取 WebSphere 8.5 服务器上已部署应用程序中特定模块的版本?

我尝试了以下命令。

获取所有已安装的应用程序:

wsadmin> $AdminApp list
MyApplicationEAR

获取此应用程序的版本 (MyApplicationEAR):

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

列出此应用程序的所有模块:

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

获取一个模块的版本(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.

但是如果我打开 WebSphere 管理控制台 GUI (localhost:xxxx/ibm/console) 并转到:

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

我可以看到所有模块的自己的版本。

EAR 的版本与META-INF/MANIFEST.MF中的每个模块的版本一样存储在Implementation-Version: XXX下。

有人提示,如何使用 wsadmin(或 Java AdminClient API)获取这些模块版本?

4

1 回答 1

2

如果您只运行模块的视图命令,例如 $AdminApp view MyAppTestEAR#MyAppTest.war+WEB-INF/web.xml,在输出的末尾,您会发现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>

更新
您实际上可以在您的应用程序上运行它,您不必指定模块:

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

并获得可用的选项,你可以运行 -tasknames

wsadmin>$AdminApp view MyAppTestEAR -tasknames
CustomActivationPlan
MetadataCompleteForModules
JSPReloadForWebMod
MapWebModToVH
SharedLibRelationship
AppDeploymentOptions
MapJaspiProvider
MapModulesToServers
MapResEnvRefToRes
ModuleBuildID
MapSharedLibForMod
CtxRootForWebMod
于 2014-07-28T14:54:30.530 回答