準備和執行應用程式用戶端
學習如何準備伺服器和用戶端,以便從 Liberty 應用程式用戶端儲存器來執行應用程式用戶端。
關於這項作業
如果要順利執行應用程式用戶端,則必須同時更新 server.xml 和 client.xml 檔。
程序
依如下所示來準備伺服器:
- 將用戶端模組 (.jar) 和 EJB 模組 (.jar) 等之類的其他模組,包裝在應用程式 EAR 檔中。
- 將 EAR 檔放在 apps 目錄中;例如 wlp/usr/servers/your_server/apps。
- 新增 appClientSupport-1.0 特性以及其他必要的特性,以更新 server.xml 配置檔。
重要: 如果您的應用程式用戶端是獨立式應用程式,就不需執行這個步驟。
- 使用您的應用程式資訊來配置 <application/>,以更新 server.xml 配置檔;例如:
<?xml version="1.0" encoding="UTF-8"?> <server description="new server"> <!- 啟用特性 -> <featureManager> <feature>javaee-7.0</feature> </featureManager> <application id="techsample" name="techSample" type="ear" location="TechnologySamples.ear"/> </server>
依如下所示來準備用戶端:
- 將 EAR 檔放在 apps 目錄中;例如 wlp/usr/clients/your_client/apps。
- 使用您的應用程式資訊來配置 <application/>,以更新 client.xml 配置檔;例如:
<?xml version="1.0" encoding="UTF-8"?> <client description="new client"> <!- 啟用特性 -> <featureManager> <feature>javaeeClient-7.0</feature> </featureManager> <application id="techsample" name="techSample" type="ear" location="TechnologySamples.ear"/> </client>
- 選擇性的: 新增 appClientSecurity-1.0 特性至 client.xml 檔。請閱讀手動建立 Liberty 應用程式用戶端。
- 啟動伺服器。
- 輸入 client run your_client,以執行用戶端。 如果您的用戶端應用程式使用指令行引數,請使用下列格式:
client run {your_client} -- arg1 arg2 ... argn
如果您的伺服器和用戶端是在不同電腦上執行,還需執行額外的步驟。依預設,伺服器和用戶端使用 localhost:2809。您必須配置 IIOP,以便建立伺服器與用戶端之間的連線,如下所示:
- 停止伺服器。
- 以 IIOP 配置來更新 server.xml 檔;例如:
<iiopEndpoint id="defaultIiopEndpoint" host="user.host.ibm.com" iiopPort="2814" />
- 以 IIOP 配置來更新 client.xml 檔;例如:
<orb id="defaultOrb" nameService="corbaname::user.host.ibm.com:2814" />
- 啟動伺服器。
註: 由於防火牆軟體會封鎖伺服器上的連線,用戶端可能無法連接伺服器。請與伺服器管理者商量,確定沒有防火牆會封鎖通往埠 2814 的入埠連線。
次主題
- 手動建立 Liberty 應用程式用戶端
您可以從指令行來建立 Liberty 應用程式用戶端。 - 建立含有多個用戶端模組的 Liberty 應用程式用戶端
您可以建立 Liberty 應用程式用戶端,並將多個用戶端模組包含在相同的 EAR 檔中。
上層主題: 設定 Liberty


http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=twlp_setup_prepareappclient
檔名:twlp_setup_prepareappclient.html