使用 wsadmin Scripting 的 AdminApp 物件指令

使用 AdminApp 物件來安裝、修改及管理應用程式。

AdminApp 物件會與 WebSphere® Application Server 管理和配置服務互動,以進行應用程式查詢和變更。 此互動包括安裝及解除安裝應用程式、列出模組、匯出等。

如果您只想使用本端作業,則可以在沒有伺服器執行時啟動 Scripting 用戶端。 如果要以本端模式執行,請使用 -conntype NONE 選項來啟動 Scripting 用戶端。 您會收到一則指出您正在執行本端模式的訊息。 不建議在伺服器目前正在執行時,以本端模式執行 AdminApp 物件。 這是因為在本端模式中所做的任何配置變更都不會反映在執行中的伺服器配置中,反之亦然。 如果您儲存的配置有衝突,配置可能會毀損。

[AIX Solaris HP-UX Linux Windows]重要事項: 如果您使用 wsadmin -conntype NONE以本端模式部署應用程式,則必須修改 install_root/bin 目錄中的 wsadmin.batwsadmin.sh 指令檔。 請完成下列步驟:
  1. 製作 install_root/bin/wsadmin.batinstall_dir/bin/wsadmin.bat 檔案的備份副本。
  2. 在呼叫 setupCmdLine.batsetupCmdLine.sh 檔案之後,直接將下列程式碼行新增至 wsadmin 檔案:
    [AIX]
    LIBPATH="$WAS_LIBPATH":$LIBPATH
    export LIBPATH EXTSHM
    [HP-UX]
    SHLIB_PATH="$WAS_LIBPATH":$SHLIB_PATH
    export SHLIB_PATH
    [Linux][Solaris]
    LD_LIBRARY_PATH="$WAS_LIBPATH":$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH
    [Windows]
    SET PATH=%WAS_PATH%
    [Solaris]避免麻煩: 不要在之前的匯出陳述式上指定 LD_LIBRARY_PATH_64 ,而不是 LD_LIBRARY_PATH。 在該匯出陳述式上指定 LD_LIBRARY_PATH_64 會置換其他 Script 中存在的任何 LD_LIBRARY_PATH 值。
  3. 儲存更新的 wsadmin.batwsadmin.sh 檔案。
  4. 部署應用程式。

在部署管理程式環境中,只有在 Scripting 用戶端連接至部署管理程式時,才能夠使用配置更新。

當連接至節點代理程式或受管理應用程式伺服器時,您無法更新配置,因為這些伺服器處理程序的配置是位於部署管理程式中的主要配置副本。 當在部署管理程式和節點代理程式之間進行配置同步化時,就會在節點機器中建立複本。 請將 Scripting 用戶端連接至部署管理程式,來進行伺服器程序的配置變更。 基於這個原因,如果要變更配置,請勿在節點機器的本端模式下執行 Scripting 用戶端。 這不是支援的配置。

下列附註適用於這個主題中的 xmi 檔案參照:
支援的配置: 對於 IBM® 延伸和連結檔, 根據您是使用Java™ EE 5 之前的應用程式或模組,還是使用 Java EE 5 或更新版本的應用程式或模組, .xmi.xml 副檔名會有所不同。 IBM 延伸或連結檔命名為 ibm-*-ext.xmiibm-*-bnd.xmi ,其中 * 是延伸或連結檔的類型,例如 appapplicationejb-jarweb。 適用下列條件:
  • 如果應用程式或模組使用第 5 版之前的 Java EE 版本,副檔名必須是 .xmi
  • 對於使用 Java EE 5 或更新版本的應用程式或模組,副檔名必須是 .xml。 如果 .xmi 檔隨附於應用程式或模組,產品會忽略 .xmi 檔。

不過, Java EE 5 或更新版本的模組可以存在於包含Java EE 5 之前的檔案且使用 .xmi 副檔名的應用程式內。

ibm-webservices-ext.xmiibm-webservices-bnd.xmiibm-webservicesclient-bnd.xmiibm-webservicesclient-ext.xmiibm-portlet-ext.xmi 檔案會繼續使用 .xmi 副檔名。

deleteUserAndGroup項目

請利用 deleteUserAndGroupEntries 指令來刪除所有角色的使用者或群組,以及刪除應用程式中所定義之所有 RunAs 角色的使用者 ID 和密碼。

目標物件

無。

必要參數

application name
指定感興趣的應用程式。

選用參數

無。

範例

  • 使用 Jacl:
    $AdminApp deleteUserAndGroupEntries myapp
  • 使用 Jython 字串:
    print AdminApp.deleteUserAndGroupEntries('myapp')
  • 使用 Jython 清單:
    print AdminApp.deleteUserAndGroupEntries(['myapp'])

編輯

使用 edit 指令,以批次模式編輯應用程式或模組。 edit 指令會使用 options 引數指定的選項來變更應用程式名稱引數指定的應用程式。 edit 指令不需要任何選項。

目標物件

無。

必要參數

應用程式名稱
指定感興趣的應用程式。
選項
指定要套用至應用程式或模組配置的選項。

選用參數

無。

範例

  • 使用 Jacl:
    $AdminApp edit "JavaMail Sample" {-MapWebModToVH {{"JavaMail Sample WebApp" mtcomps.war,WEB-INF/web.xml newVH}}}
  • 使用 Jython 字串:
    print AdminApp.edit("JavaMail Sample", '[-MapWebModToVH [["JavaMail 32 Sample WebApp" 
    mtcomps.war,WEB-INF/web.xml newVH]]]')
  • 使用 Jython 清單:
    option = [["JavaMail 32 Sample WebApp", "mtcomps.war,WEB-INF/web.xml", "newVH"]] 
    mapVHOption = ["-MapWebModToVH", option]
    print AdminApp.edit("JavaMail Sample", mapVHOption)

editInteractive

使用 editInteractive 指令,以互動模式編輯應用程式或模組。 editInteractive 指令會變更應用程式部署。 請在 options 參數中指定這些變更。 editInteractive 指令不需要任何選項。

目標物件

無。

必要參數

應用程式名稱
指定感興趣的應用程式。
選項
指定要套用至應用程式或模組配置的選項。

選用參數

無。

範例

  • 使用 Jacl:
    $AdminApp editInteractive ivtApp 
  • 使用 Jython 字串:
    AdminApp.editInteractive('ivtApp')

匯出

使用 export 指令,將應用程式名稱參數匯出至您依檔名指定的檔案。

目標物件

無。

必要參數

應用程式名稱
指定感興趣的應用程式。
檔名
指定要將應用程式名稱匯出至其中的檔名。

選用參數

exportTo本端
指定系統應將感興趣的應用程式匯出至本端用戶端機器上指定的檔名。

範例

  • 使用 Jacl:
    $AdminApp export DefaultApplication c:/temp/export.ear {-exportToLocal}
  • 使用 Jython:
    AdminApp.export('DefaultApplication', 'c:/temp/export.ear', '[-exportToLocal]')

exportDDL

使用 exportDDL 指令,將資料定義語言 (DDL) 從應用程式名稱參數擷取至目錄指定的目錄名稱參數。 options 參數是選用的。

目標物件

無。

必要參數

應用程式名稱
指定感興趣的應用程式。
目錄名稱
指定要將應用程式名稱匯出至其中的目錄名稱。

選用參數

選項
指定要傳遞至指定應用程式名稱的選項。

範例

  • 使用 Jacl:
    $AdminApp exportDDL "My App" /usr/me/DDL {-ddlprefix myApp}
  • 使用 Jython 字串:
    print AdminApp.exportDDL("My App", '/usr/me/DDL', '[-ddlprefix myApp]')

exportFile

使用 exportFile 指令,從感興趣的應用程式中匯出統一資源識別碼 (URI) 所指定的單一檔案內容。

目標物件

無。

必要參數

應用程式名稱
指定感興趣的應用程式。
URI
指定要匯出的單一檔案。 指定應用程式環境定義內的 URI ,如下列範例所示: META-INF/application.xml。 如果要指定模組內的檔案, URI 會以模組 URI 開頭,如下列範例所示: foo.war/WEB-INF/web.xml
檔名
指定要匯出至其中之檔案的完整路徑和檔名。

選用參數

無。

範例

  • 使用 Jacl:
    $AdminApp exportFile "My App" myapp/components.jar/META-INF/ibm-ejb-jar-bnd.xml
     META-INF/ibm-ejb-jar-bnd.xml 
  • 使用 Jython 字串:
    AdminApp.exportFile('My App', 'myapp/components.jar/META-INF/ibm-ejb-jar-bnd.xml', 
    'META-INF/ibm-ejb-jar-bnd.xml')

getDeploy狀態

使用 getDeployStatus 指令來顯示應用程式的部署狀態。 安裝或更新大型應用程式之後,請使用這個指令來顯示應用程式二進位檔擴充的詳細狀態資訊。 在系統擷取應用程式二進位檔之前,您無法啟動應用程式。

目標物件

無。

必要參數

應用程式名稱
指定屬意應用程式的名稱。

選用參數

無。

範例

  • 使用 Jacl:
    $AdminApp getDeployStatus myApplication
  • 使用 Jython:
    print AdminApp.getDeployStatus('myApplication')

執行 getDeployStatus 指令,其中 myApplicationDefaultApplication 會產生 DefaultApplication 類似下列的狀態資訊:

ADMA5071I: Distribution status check started for application DefaultApplication.
WebSphere:cell=myCell01,node=myNode01,distribution=unknown,expansion=unknown
ADMA5011I: The cleanup of the temp directory for application DefaultApplication is complete.
ADMA5072I: Distribution status check completed for application DefaultApplication.
WebSphere:cell=myCell01,node=myNode01,distribution=unknown,expansion=unknown

help

使用 help 指令來顯示 AdminApp 物件的一般說明資訊。

目標物件

無。

必要參數

無。

選用參數

作業名稱
指定此選項以顯示 AdminApp 指令或安裝選項的說明。

範例輸出

如果未指定引數,則會傳回下列輸出:
WASX7095I: The AdminApp object allows application objects to be manipulated including installing, 
uninstalling, editing, and listing.  Most of the commands supported by AdminApp operate in two modes: 
the default mode is one in which AdminApp communicates with the application server to accomplish its 
tasks.  A local mode is also possible, in which no server communication takes place.  The local mode of 
operation is invoked by including the "-conntype NONE" flag in the option string supplied to the command.

The following commands are supported by AdminApp; more detailed information about each of these commands 
is available by using the "help" command of AdminApp and supplying the name of the command as an argument.

edit            			Edit the properties of an application
editInteractive 			Edit the properties of an application interactively
export          			Export application to a file
exportDDL      				Extract DDL from application to a directory
help         	   			Show help information
install         			Installs an application, given a file name and an option string.
installInteractive		Installs an application in interactive mode, given a file name and an option string.
list            			List all installed applications
listModules     			List the modules in a specified 
application options 	Shows the options available, either for a given file, or in general.
taskInfo        			Shows detailed information pertaining to a given installation task for a given file
uninstall       			Uninstalls an application, given an application name and an option string
如果您指定 uninstall 作為作業名稱引數,則會傳回下列輸出:
WASX7102I: Method: uninstall
Arguments: application name, options
Description: Uninstalls application named by "application name" using the options supplied by String 2.
Method: uninstall
Arguments: application name
Description: Uninstalls the application specified by "application name" using default options.

範例

使用 Jacl:
  • 下列範例未指定任何引數:
    $AdminApp help
  • 下列範例指定作業名稱引數:
    $AdminApp help uninstall
使用 Jython:
  • 下列範例未指定任何引數:
    print AdminApp.help()
  • 下列範例指定作業名稱引數:
    print AdminApp.help('uninstall')

安裝

在給定完整檔名及安裝選項字串的情況下,使用 install 指令以非互動模式安裝應用程式。 options 參數是選用的。

目標物件

無。

必要參數

EAR 檔
指定要安裝的 .ear 檔案路徑。

選用參數

選項
指定指令的安裝選項。

範例

  • 使用 Jacl:
    $AdminApp install c:/apps/myapp.ear
  • 使用 Jython:
    print AdminApp.install('c:/apps/myapp.ear')
此指令有許多選項可用。 您可以使用下列指令來取得企業保存檔 (EAR) 的有效選項清單:

使用 Jacl:

$AdminApp options myApp.ear
使用 Jython:
print AdminApp.options('myApp.ear')
您也可以使用下列指令來取得每一個物件的說明:

使用 Jacl:

$AdminApp help MapModulesToServers
使用 Jython:
print AdminApp.help('MapModulesToServers')

installInteractive

在提供完整檔名及安裝選項字串的情況下,使用 installInteractive 指令以互動模式安裝應用程式。 options 參數是選用的。

目標物件

無。

必要參數

EAR 檔
指定要安裝的 .ear 檔案路徑。

選用參數

選項
指定指令的安裝選項。

範例

  • 使用 Jacl:
    $AdminApp installInteractive c:/websphere/appserver/installableApps/jmsample.ear
  • 使用 Jython:
    print AdminApp.installInteractive('c:/websphere/appserver/installableApps/jmsample.ear')

isApp備妥

請使用 isAppReady 指令來判斷指定的應用程式是否已配送且備妥可執行。 如果應用程式已備妥,則傳回值 true ; 如果應用程式未備妥,則傳回值 false 。 呼叫 isAppReady 的 Script 通常會安裝或更新應用程式,然後循環執行呼叫,直到呼叫在啟動應用程式之前傳回 true 值為止。 當 wsadmin 工具未連接伺服器時,不支援這個指令。

目標物件

無。

必要參數

應用程式名稱
指定感興趣的應用程式名稱。

選用參數

ignoreUnknown狀態
測試以查看指定的應用程式是否已配送且已備妥可執行。 ignoreUnknown狀態參數的有效值包括 truefalse。 如果您指定值 true,則最終備妥回覆中不會包含狀態不明的節點和伺服器。 如果應用程式已備妥,則指令會傳回值 true ,如果應用程式未備妥,則會傳回值 false 。 當 wsadmin 工具未連接伺服器時,不支援這個指令。

範例輸出

如果您指定應用程式名稱參數,則會傳回下列範例輸出:
ADMA5071I: Distribution status check started for application 
           DefaultApplication.WebSphere:cell=Node03Cell,node=myNode,distribution=true
ADMA5011I: The cleanup of the temp directory for application DefaultApplication is complete.
ADMA5072I: Distribution status check completed for application DefaultApplication.true
如果您指定應用程式名稱及 ignoreUnknown狀態參數,則會傳回下列範例輸出:
ADMA5071I: Distribution status check started for application TEST.WebSphere:cell=myCell,node=myNode,
					distribution=unknown
ADMA5011I: The cleanup of the temp directory for application TEST is complete.
ADMA5072I: Distribution status check completed for application TEST.false

範例

下列範例僅指定應用程式名稱參數:
  • 使用 Jacl:
    set result [$AdminApp isAppReady 
    DefaultApplication]
    while {$result == "false"} {
       ### Wait 5 seconds before checking again
       after 5000   
    set result [$AdminApp isAppReady DefaultApplication]
    }
    puts "Starting application..."
  • 使用 Jython:
    import time
    result = AdminApp.isAppReady('DefaultApplication')
    while (result == "false")
    :   ### Wait 5 seconds before checking again
        time.sleep(5)   
        result = AdminApp.isAppReady
    ('DefaultApplication')
    print("Starting application...")
下列範例指定應用程式名稱及 ignoreUnknown狀態參數:
  • 使用 Jacl:
    set result [$AdminApp isAppReady
    DefaultApplication]
    while {$result == "false"} {
       ### Wait 5 seconds before checking again
       after 5000   
       set result [$AdminApp isAppReady
    DefaultApplication]
    }
    puts "Starting application..."
  • 使用 Jython:
    import time
    result = AdminApp.isAppReady
    ('DefaultApplication')
    while (result == "false"):
       ### Wait 5 seconds before checking again
       time.sleep(5)   
       result = AdminApp.isAppReady
    ('DefaultApplication')
    print("Starting application...")

list

使用 list 指令來列出已安裝在配置中的應用程式。

目標物件

無。

必要參數

無。

選用參數

目標
列出安裝在配置中給定目標範圍上的應用程式。

範例輸出

adminconsole 
DefaultApplication 
ivtApp

範例

  • 使用 Jacl:
    $AdminApp list
  • 使用 Jython:
    print AdminApp.list()
下列範例指定目標參數的值:
  • 使用 Jacl:
    $AdminApp list WebSphere:cell=myCell,node=myNode,server=myServer
  • 使用 Jython:
    print AdminApp.list("WebSphere:cell=myCell,node=myNode,server=myServer")

listModules

使用 listModules 指令來列出應用程式中的模組。

目標物件

無。

必要參數

應用程式名稱
指定感興趣的應用程式。

選用參數

選項
指定安裝模組的應用程式伺服器清單。 options 參數是選用的。 有效選項為 -server。

範例輸出

下列範例是 appname、#、module URI、+ 和 DD URI 的連結。 您可以將這個字串傳遞給 editeditInteractive AdminApp 指令。
ivtApp#ivtEJB.jar+META-INF/ejb-jar.xml
ivtApp#ivt_app.war+WEB-INF/web.xml

範例

  • 使用 Jacl:
    $AdminApp listModules ivtApp
  • 使用 Jython:
    print AdminApp.listModules('ivtApp')

選項

使用 options 指令來顯示安裝企業保存檔 (EAR) 的選項清單。

目標物件

無。

必要參數

無。

選用參數

EAR 檔
指定相關的 EAR 檔。
應用程式名稱
指定要顯示選項清單以編輯現有應用程式的應用程式。
應用程式模組名稱
指定模組名稱,以顯示用來在現有應用程式中編輯模組的選項清單。 此參數需要與 listModules 指令所傳回輸出相同的模組名稱格式。
檔案,作業
顯示安裝或更新應用程式或應用程式模組檔案的選項清單。 請指定下列有效值之一:
  • installapp-使用此選項來安裝指定的檔案。
  • updateapp-使用此選項可使用指定的檔案來更新現有應用程式。
  • addmodule-請利用這個選項,將指定的模組檔新增至現有的應用程式。
  • updatemodule-使用此選項,以指定的模組檔案來更新應用程式中的現有模組。

範例輸出

WASX7112I: The following options are valid for "ivtApp"
MapRolesToUsers
BindJndiForEJBNonMessageBinding
MapEJBRefToEJB
MapWebModToVH
MapModulesToServers
distributeApp
nodistributeApp
useMetaDataFromBinary
nouseMetaDataFromBinary
createMBeansForResources
nocreateMBeansForResources
reloadEnabled
noreloadEnabled
verbose
installed.ear.destination
reloadInterval

範例

下列選項範例指令會傳回 EAR 檔的有效選項:
  • 使用 Jacl:
    $AdminApp options c:/websphere/appserver/installableApps/ivtApp.ear
  • 使用 Jython:
    print AdminApp.options('c:/websphere/appserver/installableApps/ivtApp.ear')
下列選項範例指令會傳回應用程式的有效選項:
  • 使用 Jacl:
    $AdminApp options ivtApp
  • 使用 Jython:
    print AdminApp.options('ivtApp')
下列選項範例指令會傳回應用程式模組的有效選項:
  • 使用 Jacl:
    $AdminApp options ivtApp#ivtEJB.jar+META-INF/ejb-jar.xml
  • 使用 Jython:
    print AdminApp.options('ivtApp#ivtEJB.jar+META-INF/ejb-jar.xml')
下列範例 options 指令會傳回輸入檔所要求之作業的有效選項:
  • 使用 Jacl:
    $AdminApp options c:/websphere/appserver/installableApps/ivtApp.ear updateapp
  • 使用 Jython:
    print AdminApp.options('c:/websphere/appserver/installableApps/ivtApp.ear', 'updateapp')

publishWSDL

使用 publishWSDL 指令,將應用程式名稱參數中指定之應用程式的「Web 服務說明語言 (WSDL)」檔案發佈至檔名參數中指定的檔案。

目標物件

無。

必要參數

檔名
指定感興趣的檔案。
應用程式名稱
指定感興趣的應用程式

選用參數

SOAP 位址字首
指定要使用的 SOAP 位址字首。

範例輸出

publishWSDL 指令不會傳回輸出。

範例

下列範例 publishWSDL 指令指定應用程式名稱及檔名:
  • 使用 Jacl:
    $AdminApp publishWSDL JAXRPCHandlerServer c:/temp/a.zip
  • 使用 Jython:
    print AdminApp.publishWSDL('JAXRPCHandlerServer', 'c:/temp/a.zip')
下列範例 publishWSDL 指令指定應用程式名稱、檔名及 SOAP 位址字首參數值:
  • 使用 Jacl:
    $AdminApp publishWSDL JAXRPCHandlersServer c:/temp/a.zip {{JAXRPCHandlersServerApp.war 
    {{http http://localhost:9080}}}}
  • 使用 Jython:
    print AdminApp.publishWSDL('JAXRPCHandlersServer', 'c:/temp/a.zip', '[[JAXRPCHandlersServerApp.war
     [[http http://localhost:9080]]]]')

searchJNDIReferences

使用 searchJNDIReferences 指令來列出參照特定節點上「Java 命名和目錄介面 (JNDI)」名稱的應用程式。

目標物件

無。

必要參數

節點配置 ID
指定感興趣節點的配置 ID。

選用參數

選項
指定要使用的選項。

範例輸出

WASX7410W: This operation may take a while depending on the number of applications installed in your system.
MyApp
MapResRefToEJB :ejb-jar-ic.jar : [eis/J2CCF1]

範例

下列範例假設名稱為 MyApp 的已安裝應用程式具有 JNDI 名稱 eis/J2CCF1:
  • 使用 Jacl:
    $AdminApp searchJNDIReferences $node {-JNDIName eis/J2CCF1 -verbose}
  • 使用 Jython:
    print AdminApp.searchJNDIReferences(node, '[-JNDIName eis/J2CCF1 -verbose]')

taskInfo

使用 taskInfo 指令來提供應用程式檔案特定作業選項的相關資訊。 對於類似或完全相同的作業,在 V5.x 與 V6.x 之間變更了許多作業名稱。 如果您是從 V5.x 移轉至 V6.x,則可能需要更新現有的 Script。

目標物件

無。

必要參數

EAR 檔
指定相關的 EAR 檔。
作業名稱
指定要要求資訊的作業。

選用參數

無。

範例輸出

MapWebModToVH: Selecting virtual hosts for web modules
Specify the virtual host where you want to install the web modules that are contained in
your application. Web modules can be installed on the same virtual host or dispersed among several hosts.
Each element of the MapWebModToVH task consists of the following three fields: "webModule," "uri," "virtualHost."
Of these fields, the following fields might be assigned new values: "virtualHost"and the following are 
required: "virtualHost"

The current contents of the task after running default bindings are:
webModule: JavaMail Sample WebApp
uri: mtcomps.war,WEB-INF/web.xml
virtualHost: default_host

範例

  • 使用 Jacl:
    $AdminApp taskInfo c:/websphere/appserver/installableApps/jmsample.ear MapWebModToVH
  • 使用 Jython:
    print AdminApp.taskInfo('c:/websphere/appserver/installableApps/jmsample.ear', 'MapWebModToVH')

uninstall

使用 uninstall 指令來解除安裝現有的應用程式。

目標物件

無。

必要參數

即使未執行配置儲存,也會刪除應用程式分析報告,且無法回復。

應用程式名稱
指定要解除安裝的應用程式名稱。

選用參數

選項
指定解除安裝的選項。

範例輸出

ADMA5017I: Uninstallation of myapp started.
ADMA5104I: Server index entry for myCellManager was updated successfully.
ADMA5102I: Deletion of config data for myapp from config 
repository completed successfully.
ADMA5011I: Cleanup of temp dir for app myapp done.
ADMA5106I: Application myapp uninstalled successfully.

範例

  • 使用 Jacl:
    $AdminApp uninstall myApp
  • 使用 Jython:
    print AdminApp.uninstall('myApp')

更新

使用 update 指令,以非互動模式更新應用程式。 此指令支援新增、移除及更新應用程式子元件或整個應用程式。 提供應用程式名稱、內容類型及更新選項。

目標物件

無。

必要參數

應用程式名稱
指定要更新的應用程式名稱。
內容類型
請使用內容類型參數來指出您是否要更新應用程式的一部分或整個應用程式。 下列清單包含 update 指令的有效內容類型值:
  • app -指出您要更新整個應用程式。 此選項與使用 install 指令指出更新選項相同。 以 app 值作為內容類型時,您必須指定以 update 作為值的作業選項。 使用內容選項來提供新的企業保存檔 (EAR)。 您也可以指定連結資訊及應用程式選項。 依預設,已安裝模組的連結資訊會與已更新模組的連結資訊合併。 若要變更此預設行為,請指定 update.ignore.old 或 update.ignore.new 選項。
  • file -指出您要更新單一檔案。 您可以在已部署應用程式內的任何範圍新增、移除或更新個別檔案。 以 file 值作為內容類型,您必須使用 operation 選項對檔案執行作業。 視作業類型而定,需要其他選項。 如果要新增和更新檔案,您必須利用內容和 contenturi 選項來提供檔案內容和相對於 EAR 檔根目錄的檔案 URI。 如果要刪除檔案,您必須使用 contenturi 選項來提供相對於 EAR 檔根目錄的檔案 URI ,這是唯一必要的輸入。 系統會忽略您提供的任何其他選項。
  • modulefile -指出您要更新模組。 您可以新增、移除或更新個別應用程式模組。 如果您指定 modulefile 值作為內容類型,您必須利用作業選項來指出您要在模組上執行的作業。 視作業類型而定,需要進一步的選項。 如果要安裝新的模組或更新應用程式中的現有模組,您必須利用內容和 contenturi 選項來指出檔案內容和相對於 EAR 檔根目錄的檔案 URI。 您也可以指定與新的或更新的模組相關的連結資訊和應用程式選項。 對於模組更新,依預設會將已安裝模組的連結資訊與輸入模組的連結資訊合併。 若要變更預設行為,請指定 update.ignore.old 或 update.ignore.new 選項。 如果要刪除模組,請指出相對於 EAR 檔根目錄的檔案 URI。
    限制: 一般而言,如果模組相依於模組外部的其他類別 (例如選用套件或程式庫內的類別) ,則無法新增或更新模組。 用戶端處理涉及內部檢查輸入模組類別,除非也解析類別相依關係,否則這些類別可能無法順利載入。 如果您在可透過 wsadmin Scripting 存取的檔案系統上提供必要的類別,您可以新增或更新模組。 透過 wsadmin Scripting ,您可以修改 profile_root/properties/wsadmin.properties 檔中的 com.ibm.ws.scripting.classpath 內容,以包含那些類別,讓類別載入器可以解析它們。
  • partialapp -指出您要更新局部應用程式。 使用以壓縮 .zip 檔案格式提供的應用程式元件子集,您可以更新、新增及刪除檔案和模組。 壓縮檔不是有效的 Java 2 平台 Enterprise Edition (J2EE) 保存檔。 相反地,它包含應用程式構件的階層式結構與它們在 EAR 檔中顯示的階層式結構相同。 如需如何建構局部應用程式壓縮檔的相關資訊,請參閱 Java API 一節。 如果您指出 partialapp 值作為內容類型,請使用內容選項來指定壓縮檔的位置。 當提供局部應用程式作為更新輸入時,無法指定連結資訊和應用程式選項,如果有提供,則會忽略它們。

選用參數

選項
update 指令有許多可用的選項。 如需 update 指令每一個有效選項的清單,請參閱 使用 wsadmin Scripting 的 AdminApp 物件安裝、 installInteractive、edit、 editInteractive、update 和 updateInteractive 指令的選項

執行完整應用程式更新時,即使未執行配置儲存,也會刪除應用程式分析報告,且無法回復。

範例輸出

ADMA5078I: Update of myApp has started.
ADMA5058I: Application and module versions are validated with versions of deployment targets.
ADMA5009I: Extracting application archive to C:\was\WebSphere\AppServer\profiles\AppSrv01\wstemp\appmgmt\mbean\AppManagement_16926a55ce1_1\app_16926d99097\ext.
ADMA5064I: FileMergeTask completed successfully for myApp.
ADMA5005I: The application myApp is configured in the WebSphere Application Server repository.
ADMA5005I: The application myApp is configured in the WebSphere Application Server repository.
ADMA5005I: The application myApp is configured in the WebSphere Application Server repository.
ADMA5005I: The application myApp is configured in the WebSphere Application Server repository.
ADMA5113I: Activation plan created successfully.
ADMA5005I: The application myApp is configured in the WebSphere Application Server repository.
ADMA5011I: The cleanup of the temp directory for application myApp is complete.
ADMA5079I: Update of myApp has ended. The application or its web modules may require a restart when a save is performed.

範例

  • 使用 Jacl:
    [AIX Solaris HP-UX Linux Windows]
    $AdminApp update myApp file {-operation add -contents c:/apps/myApp/customdb.xml
    -contenturi myApp.jar/META-INF/customdb.xml}
    [z/OS]
    $AdminApp update myApp file {-operation add -contents c:/apps/myApp/customdb.xml
    -contenturi myApp.jar/META-INF/customdb.xml}
  • 使用 Jython:
    [AIX Solaris HP-UX Linux Windows]
    print AdminApp.update('myApp', 'file', '[-operation add -contents c:/apps/myApp/customdb.xml
    -contenturi myApp.jar/META-INF/customdb.xml]')
    [z/OS]
    print AdminApp.update('myApp', 'file', '[-operation add -contents c:/apps/myApp/customdb.xml
    -contenturi myApp.jar/META-INF/customdb.xml]')
  • 使用 Jython 清單:
    [AIX Solaris HP-UX Linux Windows]
    print AdminApp.update('myApp', 'file', ['-operation', 'add', '-contents', 'c:/apps/myApp/customdb.xml',
    '-contenturi', 'myApp.jar/META-INF/customdb.xml']))
    [z/OS]
    print AdminApp.update('myApp', 'file', ['-operation', 'add', '-contents', 'c:/apps/myApp/customdb.xml',
    '-contenturi', 'myApp.jar/META-INF/customdb.xml'])

updateAccessID

使用 updateAccessIDs 指令來更新指派給應用程式中所定義各種角色之使用者和群組的存取 ID 資訊。 系統會從使用者登錄讀取存取 ID ,並將 ID 儲存在應用程式連結中。 這項作業可改善應用程式的執行時期效能。 在安裝應用程式之後,或在編輯已安裝應用程式的安全角色特定資訊之後,請使用這個指令。 當 wsadmin 工具的 -conntype 選項設為 NONE時,無法呼叫這個方法。 您必須連接至伺服器,才能呼叫此指令。

目標物件

無。

必要參數

應用程式名稱
指定屬意應用程式的名稱。
bALL
bALL 布林參數會擷取並儲存應用程式連結中使用者和群組的所有存取 ID。 指定 false ,則會擷取應用程式連結中沒有存取 ID 之使用者或群組的存取 ID。

範例

  • 使用 Jacl 或 true:
    $AdminApp updateAccessIDs myapp true
  • 使用 Jacl for false:
    $AdminApp updateAccessIDs myapp false
  • 使用 true的 Jython:
    print AdminApp.updateAccessIDs('myapp', 1)
  • 使用 false的 Jython:
    print AdminApp.updateAccessIDs('myapp', 0)

updateInteractive

使用 updateInteractive 指令來新增、移除及更新應用程式子元件或整個應用程式。 當您使用互動模式來更新應用程式模組或整個應用程式時,您用來配置連結資訊的步驟與適用於 installInteractive 指令的步驟類似。 如果您更新檔案或局部應用程式,則無法使用您用來配置連結資訊的步驟。 在此情況下,步驟與您在 update 指令中使用的步驟相同。

目標物件

無。

必要參數

應用程式名稱
指定要更新的應用程式名稱。
內容類型
請使用內容類型參數來指出您是否要更新應用程式的一部分或整個應用程式。 下列清單包含 updateInteractive 指令的有效內容類型值:
  • app -指出您要更新整個應用程式。 此選項與使用 install 指令指出更新選項相同。 以 app 值作為內容類型時,您必須指定以 update 作為值的作業選項。 使用內容選項來提供新的企業保存檔 (EAR)。 您也可以指定連結資訊及應用程式選項。 依預設,已安裝模組的連結資訊會與已更新模組的連結資訊合併。 若要變更此預設行為,請指定 update.ignore.old 或 update.ignore.new 選項。
  • file -指出您要更新單一檔案。 您可以在已部署應用程式內的任何範圍新增、移除或更新個別檔案。 以 file 值作為內容類型,您必須使用 operation 選項對檔案執行作業。 視作業類型而定,需要其他選項。 如果要新增和更新檔案,您必須利用內容和 contenturi 選項來提供檔案內容和相對於 EAR 檔根目錄的檔案 URI。 如果要刪除檔案,您必須使用 contenturi 選項來提供相對於 EAR 檔根目錄的檔案 URI ,這是唯一必要的輸入。 系統會忽略您提供的任何其他選項。
  • modulefile -指出您要更新模組。 您可以新增、移除或更新個別應用程式模組。 如果您指定 modulefile 值作為內容類型,您必須利用作業選項來指出您要在模組上執行的作業。 視作業類型而定,需要進一步的選項。 如果要安裝新的模組或更新應用程式中的現有模組,您必須利用內容和 contenturi 選項來指出檔案內容和相對於 EAR 檔根目錄的檔案 URI。 您也可以指定與新的或更新的模組相關的連結資訊和應用程式選項。 對於模組更新,依預設會將已安裝模組的連結資訊與輸入模組的連結資訊合併。 若要變更預設行為,請指定 update.ignore.old 或 update.ignore.new 選項。 如果要刪除模組,請指出相對於 EAR 檔根目錄的檔案 URI。
    限制: 一般而言,如果模組相依於模組外部的其他類別 (例如選用套件或程式庫內的類別) ,則無法新增或更新模組。 用戶端處理涉及內部檢查輸入模組類別,除非也解析類別相依關係,否則這些類別可能無法順利載入。 如果您在可透過 wsadmin Scripting 存取的檔案系統上提供必要的類別,您可以新增或更新模組。 透過 wsadmin Scripting ,您可以修改 profile_root/properties/wsadmin.properties 檔中的 com.ibm.ws.scripting.classpath 內容,以包含那些類別,讓類別載入器可以解析它們。
  • partialapp -指出您要更新局部應用程式。 使用以壓縮 .zip 檔案格式提供的應用程式元件子集,您可以更新、新增及刪除檔案和模組。 壓縮檔不是有效的 Java 2 平台 Enterprise Edition (J2EE) 保存檔。 相反地,它包含應用程式構件的階層式結構與它們在 EAR 檔中顯示的階層式結構相同。 如需如何建構局部應用程式壓縮檔的相關資訊,請參閱 Java API 一節。 如果您指出 partialapp 值作為內容類型,請使用內容選項來指定壓縮檔的位置。 當提供局部應用程式作為更新輸入時,無法指定連結資訊和應用程式選項,如果有提供,則會忽略它們。

選用參數

選項
updateInteractive 指令有許多可用的選項。 如需 updateInteractive 指令每一個有效選項的清單,請參閱 使用 wsadmin Scripting 的 AdminApp 物件安裝、 installInteractive、edit、 editInteractive、update 和 updateInteractive 指令的選項

執行完整應用程式更新時,即使未執行配置儲存,也會刪除應用程式分析報告,且無法回復。

範例輸出

WASX7266I: A was.policy file exists for this application; would you like to display it?[No]

Task[1]: Specifying application options

Specify the various options that are available for your application.

Precompile JavaServer Pages files:  [No]:
Deploy enterprise beans:  [No]:
Deploy Web services:  [No]:
Validate schema:  [No]:


Task[3]: Clone Existing Work Classes.
Clone existing work classes from from an available application edition.
....Clone work class is disabled.


Task[4]: Selecting servers

Specify targets such as application servers or clusters of application servers where you want to install the modules 
that are contained in your application. Modules 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 this application.
The plug-in configuration file (plugin-cfg.xml) for each Web server is generated, based on the applications that are routed through.

Module:  Default Web Application
URI:  DefaultWebApplication.war,WEB-INF/web.xml
Server:  [WebSphere:cell=LAPTOP-6LGKFAPUNode03Cell,node=LAPTOP-6LGKFAPUNode05,server=server1]:


Task[6]: Configure JASPI authentication.

JASPI providers offer an alternative to JAAS pluggable authentication for web modules.  By default, an application 
inherits the JASPI settings defined in the WebSphere Application Server global or domain security configuration and 
web modules inherit the application setting.  However, you can override these defaults by using wsadmin or the administrative console.

Module:  DefaultApplication
URI:  META-INF/application.xml
Use JASPI:  [Inherit]:
JASPI provider name:  []:

Module:  Default Web Application
URI:  DefaultWebApplication.war,WEB-INF/web.xml
Use JASPI:  [Inherit]:
JASPI provider name:  []:


Task[10]: Binding enterprise Bean to JNDI names

Each non-message-driven enterprise bean in your application or module must be bound to a Java Naming and Directory Interface (JNDI) name. 
For beans in a pre-EJB 3.0 module, you have to use JNDI name for the bean to provide the binding. For beans in a EJB 3.0 module, 
you can optionally provide binding through JNDI name for the bean or local/remote home JNDI names. If JNDI name for the bean is specified, 
you cannot specify binding for its local/remote home and any business interface. If no JNDI name is specified for beans in a EJB 3.0 module, 
runtime will provide a container default.

Module:  Default Web Application
Bean:  IncrementSSB
URI:  DefaultWebApplication.war,WEB-INF/ejb-jar.xml
Target Resource JNDI Name:  [null]:
Local Home JNDI Name:  [null]:
Remote Home JNDI Name:  [null]:


Task[12]: Binding enterprise Bean with business interface to JNDI names

Each enterprise bean with a business interface in a module must be bound to a Java Naming and Directory Interface (JNDI) name. 
For any business interface that does not provide a JNDI name, if its bean does not provide a JNDI name, a default binding name is provided.
If its bean provides a JNDI name, then a default is provided on top of its bean JNDI name.

Module:  Default Web Application
Bean:  IncrementSSB
URI:  DefaultWebApplication.war,WEB-INF/ejb-jar.xml
Business interface:
JNDI Name:  []:


Task[13]: Mapping EJB references to enterprise beans

Each Enterprise JavaBeans (EJB) reference that is defined in your application must map to an enterprise bean.

Module:  Default Web Application
Bean:
URI:  DefaultWebApplication.war,WEB-INF/web.xml
Resource Reference:  HitCount/inc
Class:  com.ibm.defaultapplication.IncrementSSB
Target Resource JNDI Name:  []:


Task[20]: Selecting virtual hosts for Web modules

Specify the virtual host for the Web modules that are contained in your application. You can install Web modules 
on the same virtual host or disperse them among several hosts.

Web module:  Default Web Application
URI:  DefaultWebApplication.war,WEB-INF/web.xml
Virtual host:  [default_host]:


Task[21]: Specify the Context root of web module

Configure values for context roots in web modules.

Web module:  Default Web Application
URI:  DefaultWebApplication.war,WEB-INF/web.xml
Context Root:  [/]:


Task[31]: Specifying EJB deploy options

Specify the options to deploy enterprise beans. Select database type only when all of the modules are mapped 
to the same database type. If some modules map to a different backend ID, set the database type blank so that 
the Select current backend ID panel is displayed.

....The EJB deploy option is not enabled.


Task[33]: Assign shared libraries to application or each module

Specify shared libraries that the application or individual modules reference. These libraries must be 
defined in the configuration at the appropriate scope.

Module:  Default Web Application
URI:  DefaultWebApplication.war,WEB-INF/web.xml
Shared Libraries:  []:


Task[34]: Assign asset or composition unit IDs as shared libraries to the application or each module

Specify asset or composition unit IDs as shared libraries that the application or individual modules reference. 
If a composition unit ID is specified, it must be part of the business level application that this enterprise 
application belongs to. If an asset ID is specified, a composition unit is created from the asset.

When editing an application, only composition unit IDs can be specified as shared libraries.

Module:  Default Web Application
URI:  DefaultWebApplication.war,WEB-INF/web.xml
Asset or composition unit IDs:  []:
Composition Unit names:  []:
Match target:  [Yes]:


Task[35]: Specifying JSP deploy options

Specify the options for JSP precompiler.

....The JSP deploy option is not enabled.


Task[36]: Specify JSP reload options for web module

Configure Servlet and JSP reload attributes in web modules.

Web module:  Default Web Application
URI:  DefaultWebApplication.war,WEB-INF/web.xml
JSP enable class reloading:  [Yes]:
JSP reload interval in seconds:  [10]:


Task[38]: Set the metadata-complete attribute of the deployment descriptor for the module

The metadata-complete attribute defines whether the deployment descriptor for this module is complete. 
Set the metadata-complete attribute to "true" to merge and persist annotation-based metadata with existing XML-based 
deployment descriptor metedata to avoid scanning of annotation-based metadata each time the module is read. 
If the attribute remains "false", then the annotation-based metadata is scanned each time the module is read and can impact performance.

Module:  Default Web Application
URI:  DefaultWebApplication.war,WEB-INF/ejb-jar.xml
metadata-complete attribute:  [false]:

Module:  Default Web Application
URI:  DefaultWebApplication.war,WEB-INF/web.xml
metadata-complete attribute:  [false]:


Task[39]: Specify runtime provisioning components to be added or removed

Specify runtime components that should be added to or removed from the default runtime components that are 
needed to run this application.  This step is for advanced users and should only be used in those cases when 
all the runtime components needed for the application cannot be obtained by inspecting the application.

Module:  Default Web Application
URI:  DefaultWebApplication.war,WEB-INF/ejb-jar.xml
Runtime Provisioning Components To Add:  []:
Runtime Provisioning Components To Remove:  []:

Module:  Default Web Application
URI:  DefaultWebApplication.war,WEB-INF/web.xml
Runtime Provisioning Components To Add:  []:
Runtime Provisioning Components To Remove:  []:


Task[40]: Module Build ID

Display module build IDs.

Module:  Default Web Application
URI:  DefaultWebApplication.war,WEB-INF/web.xml
Build ID:


Task[41]: Copy WSDL files

Copy WSDL files

....This task does not require any user input


Task[42]: Specify options to deploy Webservices

Specify options to deploy Webservices

....WebServices Deploy option is not enabled.
ADMA5078I: Update of DefaultApplication has started.
ADMA5058I: Application and module versions are validated with versions of deployment targets.
ADMA5009I: Extracting application archive to C:\was9.0\cf111907.02\WebSphere\AppServer\profiles
\AppSrv02\wstemp\appmgmt\mbean\AppManagement_16926a55ce1_1\app_16926e99953\ext\DefaultWebApplication.war.
ADMA5064I: FileMergeTask completed successfully for DefaultApplication.
ADMA5005I: The application DefaultApplication is configured in the WebSphere Application Server repository.
ADMA5005I: The application DefaultApplication is configured in the WebSphere Application Server repository.
ADMA5005I: The application DefaultApplication is configured in the WebSphere Application Server repository.
ADMA5005I: The application DefaultApplication is configured in the WebSphere Application Server repository.
ADMA5113I: Activation plan created successfully.
ADMA5005I: The application DefaultApplication is configured in the WebSphere Application Server repository.
ADMA5011I: The cleanup of the temp directory for application DefaultApplication is complete.
ADMA5079I: Update of DefaultApplication has ended. The application or its web modules may require a restart when a save is performed.

範例

  • 使用 Jacl:
    [AIX Solaris HP-UX Linux Windows]
    $AdminApp updateInteractive myApp modulefile {-operation update -contents c:/apps/myApp/DefaultWebApplication.war 
    -contenturi DefaultWebApplication.war -nodeployejb}
    [z/OS]
    $AdminApp updateInteractive myApp modulefile {-operation add -contents /apps/myApp/Increment.jar 
    -contenturi Increment.jar -nodeployejb -BindJndiForEJBNonMessageBinding {{"Increment EJB module" 
    Increment Increment.jar,META-INF/ejb-jar.xml Inc}}}
  • 使用 Jython:
    [AIX Solaris HP-UX Linux Windows]
    print AdminApp.updateInteractive('myApp', 'modulefile', '[-operation update -contents c:/apps/myApp/DefaultWebApplication.war 
    -contenturi DefaultWebApplication.war -nodeployejb]')
    [z/OS]
    print AdminApp.updateInteractive('myApp', 'modulefile', '[-operation add -contents /apps/myApp/Increment.jar 
    -contenturi Increment.jar -nodeployejb -BindJndiForEJBNonMessageBinding [["Increment EJB module" 
    Increment Increment.jar,META-INF/ejb-jar.xml Inc]]]')
  • 使用 Jython 清單:
    [AIX Solaris HP-UX Linux Windows]
    print AdminApp.updateInteractive('myApp', 'modulefile', ['-operation', 'update',
     '-contents', 'c:/apps/myApp/DefaultWebApplication.war', '-contenturi', 'DefaultWebApplication.war, '-nodeployejb'])
    在 9.0.0.11之前, DefaultApplication 包含具有實體 EJB 的 Increment.jar 。 若為 9.0.0.10 及更舊版本的產品, Jython 清單範例如下:
    bindJndiForEJBValue = [["Increment EJB module", "Increment","Increment.jar,META-INF/ejb-jar.xml", "Inc"]]
    
    print AdminApp.updateInteractive('myApp', 'modulefile', ['-operation', 'add',
     '-contents', 'c:/apps/myApp/Increment.jar', '-contenturi', 'Increment.jar', '-nodeployejb',
     '-BindJndiForEJBNonMessageBinding', bindJndiForEJBValue])
    [z/OS]
    bindJndiForEJBValue = [["Increment EJB module", "Increment", "Increment.jar,META-INF/ejb-jar.xml", "Inc"]]
    
    print AdminApp.updateInteractive('myApp', 'modulefile', ['-operation', 'add',
     '-contents',  '/apps/myApp/Increment.jar', '-contenturi', 'Increment.jar', '-nodeployejb',
     '-BindJndiForEJBNonMessageBinding', bindJndiForEJBValue])

檢視

使用 view 指令來檢視由作業名稱參數指定的作業,或由應用程式名稱參數指定的模組。 請使用 -tasknames 作為選項來取得應用程式的有效作業名稱清單。 否則,請指定一或多個作業名稱作為選項。

目標物件

無。

必要參數

指定要檢視的應用程式或模組名稱。

選用參數

bALL
bALL 布林參數會擷取並儲存應用程式連結中使用者和群組的所有存取 ID。 指定 false ,則會擷取應用程式連結中沒有存取 ID 之使用者或群組的存取 ID。
-buildVersion
指定是否顯示感興趣應用程式的建置版本。

範例輸出

如果您對作業名稱參數指定 taskoptions 值,則指令會傳回下列資訊:
MapModulesToServers
MapWebModToVH
MapRolesToUsers
如果您對作業名稱參數指定 mapModulesToServers 作業,則指令會傳回下列資訊:
MapModulesToServers: Selecting Application Servers

Specify the application server where you want to install the modules that are contained in your 
application. Modules can be installed on the same server or dispersed among several servers:   

Module:  adminconsole
URI:  adminconsole.war,WEB-INF/web.xml
Server:  WebSphere:cell=juniartiNetwork,
node=juniartiManager,server=dmgr

範例

下列 view 指令範例列出每一個可用的作業名稱:
  • 使用 Jacl:
    $AdminApp view DefaultApplication {-tasknames}
  • 使用 Jython:
    print AdminApp.view('DefaultApplication', ['-tasknames'])
下列 view 指令範例會傳回 mapModulesToServer 作業的資訊:
  • 使用 Jacl:
    $AdminApp view DefaultApplication {-MapModulesToServers}
  • 使用 Jython:
    print AdminApp.view('DefaultApplication', ['-MapModulesToServers'])
下列 view 指令範例會傳回 AppDeploymentOptions 作業的資訊:
  • 使用 Jacl:
    $AdminApp view DefaultApplication {-AppDeploymentOptions}
  • 使用 Jython:
    print AdminApp.view('DefaultApplication', '-AppDeploymentOptions')
下列 view 指令範例會傳回 DefaultApplication 應用程式的建置版本:
  • 使用 Jacl:
    $AdminApp view DefaultApplication {-buildVersion}
  • 使用 Jython:
    print AdminApp.view('DefaultApplication', '-buildVersion')