Plants by WebSphere |
|
開始使用 |
識別目錄結構 |
重新建置和安裝範例 |
在 J2EE 平台上開發應用程式其中一個最大的好處是具備可攜性。「範例展示區」中的所有範例程式都是在工作站上開發,
且不需變更任何一行 Java 程式碼,即可在 z/OS 和 iSeries 系統上執行。藉由將 J2EE 應用程式建置在 Intel 或 UNIX 系統上,
開發人員即不需面臨將 EBCDIC 轉換成 ASCII 或將 ASCII 轉換成 EBCDIC 檔案的苦差事。由於工具的可用性,
開發人員可輕鬆在開發工作站上進行撰寫和測試,並將企業保存檔 (EAR) 安裝在 z/OS 和 iSeries 系統上。
WebSphere Application Server (Application Server) for z/OS 和 iSeries 的每一個客戶,都能夠使用多平台的 Application Server 媒體。如果您將 WebSphere Application Server Base 基礎產品和範例安裝在此套件所支援的其中一個平台上,
可看到相同的展示區。不過,例外的是當您按一下 sample_name > 使用 Ant 來建置 > 平台 > 重新建置和安裝 sample.ear 檔,
將會指示您在該平台上重新建置 EAR 檔。由於 EAR 檔中的文字檔(XML、xmi、JavaServer Pages (JSP) 檔等)必須採 ASCII 格式,
因此可輕鬆在 ASCII 機器上編輯這些檔案。如果您在 ASCII 機器上進行變更,之後您可以將最後結果的
EAR 檔部署和安裝在 z/OS 和 iSeries 平台上,而不需將 EBCDIC 轉換成 ASCII。
將 WebSphere Application Server 安裝在您所選的分散式平台上, 並指出要安裝應用程式伺服器的範例應用程式。
在試著修改或重新建置範例前,先備份 <profile_root>/samples 目錄。建立 samples 目錄的 zip 檔。您可以解壓縮 zip 檔,將 samples 目錄還原成原始狀態。
範例安裝在下列目錄中:
<profile_root>/samples/src/PlantsByWebSphere | 內含 Plants by WebSphere 範例的範例程式碼。 |
<profile_root>/samples/lib/PlantsByWebSphere | 內含 Plants by WebSphere 範例的 Web 保存檔 (WAR)、Java 保存檔 (JAR) 和最終的 PlantsByWebSphere.ear 檔。這個目錄是在重建 Plants by WebSphere 範例後建立的。 |
<profile_root>/samples/javadoc/PlantsByWebSphere | 內含 Javadoc 文件。這個目錄是在重建 Plants by WebSphere 範例後建立的。 |
<profile_root>/samples/bld/PlantsByWebSphere | 內含所產生的類別檔。請使用這些類別檔來產生最終的 PlantsByWebSphere.ear 檔。 這個目錄是在重建 Plants by WebSphere 範例後建立的。 |
Plants by WebSphere 範例會隨 WebSphere Application Server 自動安裝。在使用 Plants by WebSphere 範例前, 不需先建置。下列指示說明重新建置範例的相關步驟,以及和修改有關的其他資訊。
執行範例建置 Script |
若要重建這個範例,請確認 profile_root/bin 位於 PATH 環境變數中。 請遵循下列步驟來執行範例建置 Script,以重新建置範例:
此時會建置範例。
位於 profile_root/samples/bin/PlantsByWebSphere 目錄中的 buildplantsby.bat 和 buildplantsby.sh Script, 會設定適當的類別路徑資訊並執行 Ant 建置公用程式。Ant 會讀取說明如何建置範例的 build.xml 檔。有關 Ant 的其他文件, 請參閱 Jakarta 網站。
在建置程序期間,只會重新建置已變更的類別檔。其餘的類別檔會重新包裝成新的 EAR 檔。
請按照下列指示,使用「檔案傳送通訊協定 (FTP)」將二進位 EAR 檔傳送至 z/OS 或 iSeries 伺服器。
依預設,Plants by WebSphere 範例安裝在 profile_root/installedApps/<cell
name> 目錄中,其中 <cell name> 是安裝應用程式的
Cell 名稱。請按下列步驟中的說明,重新安裝範例:
wsadmin -conntype none -lang jython -c "AdminApp.uninstall('PlantsByWebSphere')"
wsadmin.sh -conntype none -lang jython -c "AdminApp.uninstall('PlantsByWebSphere')"
wsadmin.sh -conntype none -lang jython -c "AdminApp.uninstall('PlantsByWebSphere')"
wsadmin -conntype none -lang jython -c "AdminApp.uninstall('PlantsByWebSphere')"
wsadmin -conntype none -lang jython -c "AdminApp.install('PlantsByWebSphere.ear', ['-appname', 'PlantsByWebSphere', '-usedefaultbindings', '-node', '<node>', '-server', '<server>', '-deployejb', '-deployejb.dbtype', 'DERBY_V10'] )"其中 <node> 是節點名稱,<server> 是要安裝範例的伺服器名稱。
wsadmin.sh -conntype none -lang jython -c "AdminApp.install('PlantsByWebSphere.ear', ['-appname', 'PlantsByWebSphere', '-usedefaultbindings', '-node', '<node>', '-server', '<server>', '-deployejb', '-deployejb.dbtype', 'DERBY_V10'] )"其中 <node> 是節點名稱,<server> 是要安裝範例的伺服器名稱。
wsadmin.sh -conntype none -lang jython -c "AdminApp.install('PlantsByWebSphere.ear', ['-appname', 'PlantsByWebSphere', '-usedefaultbindings', '-node', '<node>', '-server', '<server>', '-deployejb', '-deployejb.dbtype', 'DERBY_V10'] )"
wsadmin -conntype none -lang jython -c "AdminApp.install('PlantsByWebSphere.ear', ['-appname', 'PlantsByWebSphere', '-usedefaultbindings', '-node', '<node>', '-server', '<server>', '-deployejb', '-deployejb.dbtype', 'DERBY_V10'] )"其中 <node> 是節點名稱,<server> 是要安裝範例的伺服器名稱。
此時,會將已重新建置的 PlantsByWebsphere.ear 檔部署到應用程式伺服器中。