將 Web 應用程式部署在 WebSphere Application Server Liberty 設定檔上

您可以將 Rational® Publishing Engine Web 應用程式部署在具有 IBM® DB2®WebSphere® Application Server Liberty 上。

開始之前

在部署 Web 應用程式之前,您必須先安裝 WebSphere Application Server Liberty 和含有「RPE 遠端服務」特性的 Rational Publishing Engine

程序

  1. 為 Web 應用程式建立 Liberty 設定檔伺服器
  2. com.ibm.rpe.web.app.ear 檔從 RPE_HOME\remote-services 目錄複製到 Liberty apps 目錄,以部署該檔案。 請參閱 WebSphere Application Server Liberty 產品說明文件中的將 Web 應用程式部署到 Liberty 設定檔
  3. 使用 16K 分頁和 UTF-8 字碼集為 Web 應用程式建立資料庫。 如需建立資料庫的相關資訊,請參閱 IBM DB2 產品說明文件。
  4. 設定 VCAP_SERVICES 變數:
    • Windows:將下列文字新增至 <Liberty_install_dir>\bin\server.bat 檔:
      set VCAP_SERVICES={"sqldb": [{}]}
    • Linux:將下列文字新增至 <Liberty_install_dir>\bin\server.sh 檔:
      export VCAP_SERVICES={"sqldb":[{}]}
  5. (選用)如果您將 rpeng.war dgaas.war 檔部署在不同的應用程式伺服器或機器上, 您必須設定 DGAAS_URL 變數。如果您已部署 com.ibm.rpe.web.app.ear 檔,則可以跳過此步驟。
    • Windows:將下列文字新增至 <Liberty_install_dir>\bin\server.bat 檔:
      set DGAAS_URL="http://[server IP]:[port]/dgaas/"
    • Linux:將下列文字新增至 <Liberty_install_dir>\bin\server.sh 檔:
      export DGAAS_URL="http://[server IP]:[port]/dgaas/" 
  6. 編輯 server.xml 檔,來配置 Liberty 設定檔的資料庫連線功能。
    1. 新增下列特性:
      <featureManager>
                 <feature>jsp-2.2</feature> 
                 <feature>servlet-3.0</feature> 
                 <feature>appSecurity-2.0</feature> 
                 <feature>jndi-1.0</feature>   
                 <feature>jpa-2.0</feature>  
                 <feature>jdbc-4.0</feature>
          </featureManager>
    2. 定義共用程式庫來指向 JDBC 驅動程式 JAR 或壓縮檔的位置。
      <jdbcDriver id="db2-lib">
                 <library>
                     <fileset caseSensitive="false" dir="C:\Program Files\IBM\SQLLIB\java"/>  
                 </library> 
                </jdbcDriver>
    3. 使用 rpengdgaas 資料來源的 JDBC 驅動程式及連線詳細資料, 來定義資料來源。
      <dataSource id="rpeng" jdbcDriverRef="db2-lib" jndiName="jdbc/RPENG_DB">
                 <properties.db2.jcc databaseName="databasename" password="password" serverName="ipaddress" user="db2admin"/>
                </dataSource>
               <id="DGAAS_DB" jdbcDriverRef="db2-lib" jndiName="jdbc/DGAAS_DB">
                 <properties.db2.jcc databaseName="databasename" password="password" serverName="ipaddress" user="db2admin"/>
                </dataSource>
    請參閱 WebSphere Application Server Liberty 產品說明文件中的在 Liberty 設定檔中配置資料庫連線功能
  7. server.xml 檔中新增下列項目, 以啟用 http://server:port/dgaas/debug
    <classloading useJarUrls="true"/>
  8. server.xml 檔中新增下列項目, 以便在階段作業管理程式回應未獲授權的要求時,讓階段作業失效, 而不是發出 UnauthorizedSessionRequestException 錯誤訊息:
    <httpSession invalidateOnUnauthorizedSessionRequestException="true"></httpSession>
  9. server.xml 檔中新增下列配置。 idname 是選用屬性。 location 屬性不必是完整的,因為依預設 Liberty 會查看 apps 目錄。
    <application id="" name="rpeng" type="ear" location="[Liberty_install_dir]\usr\servers\rpeng\apps\com.ibm.rpe.web.app.ear" >
         <classloader apiTypeVisibility="spec,ibm-api,api"/>
    </application>
    如果您已部署 rpeng.wardgaas.war 檔,而非 .ear 檔,您需要新增 2 筆應用程式項目,而不是 1 筆:
    <application id="" name="rpeng" location="rpeng.war" type="war>
         <classloader commonLibraryRef="rcl" apiTypeVisibility="spec,ibm-api,api"/>
    </application>
    <application id="" name="dgaas" location="dgaas.war" type="war>
         <classloader commonLibraryRef="rcl" apiTypeVisibility="spec,ibm-api,api"/>
    </application>
  10. 根據這個主題底端的範例區段中的 server.xml 範例, 來驗證您的配置設定。
  11. 設定授權變數。請參閱驗證 TELELOGIC_LICENSE_FILE 環境變數
  12. 啟動 Liberty 設定檔。 執行文件產生之後,所有資產和資料都會儲存在資料庫中。

結果

您可以在瀏覽器中開啟 Rational Publishing Engine Web 應用程式的介紹頁面, 確認已部署 Web 應用程式,網址是:http://server:port/rpeng/
記住: 如果您在 Web 瀏覽器中遇到 UnauthorizedSessionRequestException 錯誤訊息, 請驗證您已完成上述步驟,亦即,在 server.xml 檔中新增下列項目:
<httpSession invalidateOnUnauthorizedSessionRequestException="true"></httpSession>

範例

配置成部署 Web 應用程式的 server.xml 檔範例:
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
    <!-- Enable features -->
    <featureManager>
       <feature>jsp-2.2</feature> 
       <feature>jndi-1.0</feature>   
       <feature>jpa-2.0</feature>  
       <feature>jdbc-4.0</feature>
       <feature>servlet-3.0</feature> 
       <feature>appSecurity-2.0</feature>
    </featureManager>
    <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
    <httpEndpoint id="defaultHttpEndpoint" httpPort="9080" httpsPort="9443" host="localhost"/>
    <classloading useJarUrls="true"/>
    <!-- User creation-->
    <basicRegistry id="form" realm="WebRealm">
       <user name="rpe_user" password="xyz" />
       <user name="rpe_report_designer" password="xyz" />
       <user name="rpe_admin" password="xyz" />
    </basicRegistry>
    <application type="ear" location="C:\IBM\WebSphere\Liberty\usr\servers\rpeng\apps\com.ibm.rpe.web.app.ear">
       <classloader apiTypeVisibility="spec, ibm-api, api" commonLibraryRef="rcl" />
       <application-bnd>
          <security-role name="rpe_user">
             <user name="rpe_user" />
          </security-role>
          <security-role name="rpe_report_designer">
             <user name="rpe_report_designer" />
          </security-role>
          <security-role name="rpe_admin">
             <user name="rpe_admin" />
          </security-role>
       </application-bnd>
    </application>
    <httpSession invalidateOnUnauthorizedSessionRequestException="true"></httpSession>
    <!--Database Configuration -->
    <jdbcDriver id="db2-lib">
       <library>
          <fileset caseSensitive="false" dir="C:\Program Files\IBM\SQLLIB\java"/>  
       </library> 
    </jdbcDriver>
    <dataSource id="rpeng" jdbcDriverRef="db2-lib" jndiName="jdbc/RPENG_DB">
       <properties.db2.jcc databaseName="databasename" password="password" serverName="ipaddress" user="db2admin"/>
    </dataSource>
    <dataSource id="DGAAS_DB" jdbcDriverRef="db2-lib" jndiName="jdbc/DGAAS_DB">
       <properties.db2.jcc databaseName="databasename" password="password" serverName="ipaddress" user="db2admin"/>
    </dataSource>
</server>

下一步

您可以選擇性地部署和執行 Newskeeper 範例應用程式, 這個範例應用程式使用文件產生服務技術來產生文件,並提供用於文件產生服務資產和文件的儲存介面。如需詳細資料,請參閱執行 Newskeeper 範例

配置 Rational Publishing Engine Web 應用程式(該 Web 應用程式列在 http://server:port/rpeng/ 頁面中)。請參閱 Web 應用程式 URL,以取得每個 URL 的使用方式及每個特性的配置作業的說明。