將「文件建置器」部署在 WebSphere Application Server Liberty 設定檔上

您可以將 Rational® Publishing Engine 的「文件建置器」部署在 WebSphere® Application Server Liberty 上,並使用「文件建置器」Web 應用程式隨附的 IBM® DB2®、Oracle 或 Derby 資料庫(僅供評估用)。

開始之前

在部署「文件建置器」之前,您必須先安裝 WebSphere Application Server Liberty,以及具有「RPE 文件建置器」特性的 Rational Publishing Engine

程序

  1. 為「文件建置器」建立 Liberty 設定檔伺服器
  2. com.ibm.rpe.web.app.ear 檔從 RPE_HOME\document-builder 目錄複製到 Liberty apps 目錄,以部署該檔案。 請參閱 WebSphere Application Server Liberty 產品說明文件中的將 Web 應用程式部署到 Liberty 設定檔
  3. 為「文件建置器」建立具有 16K 分頁和 UTF-8 字碼集的資料庫。
    • 若為 DB2:舉例來說,如果要建立一個稱為 rpedb2,並且使用 16K 分頁和 UTF-8 字碼集的資料庫,請使用下列指令:
      db2 CREATE DATABASE rpedb2 AUTOMATIC STORAGE Yes USING CODESET UTF-8
          TERRITORY US COLLATE USING SYSTEM PAGESIZE 16384;
      如需建立資料庫的相關資訊,請參閱 IBM DB2 產品說明文件。
    • 若為 Oracle,請參閱WebSphere Application Server 配置成以 Oracle 作為資料來源的「建立資料庫和表格空間」區段中的範例
    • 若為 Derby:不需要資料庫。
  4. 若為 DB2 或 Oracle,請設定 VCAP_SERVICES 變數(若為 Derby,則不需要設定):
    • 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 或壓縮檔的位置(若為 Derby,則不需要)。
      若為 DB2:
      <jdbcDriver id="db2-lib">
                 <library>
                     <fileset caseSensitive="false" dir="C:\Program Files\IBM\SQLLIB\java"/>  
                 </library> 
                </jdbcDriver>
      若為 Oracle:
      <jdbcDriver id="OracleLib">
                 <library>
                      <fileset caseSensitive="false" dir="/oracle_jdbc" includes="*.jar">  
                 </library> 
                </jdbcDriver>
    3. 使用 rpengdgaas 資料來源的 JDBC 驅動程式及連線詳細資料, 來定義資料來源(若為 Derby,則不需要)。
      若為 DB2:
      <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> 
      若為 Oracle:
       <dataSource id="rpeng_db" jdbcDriverRef="OracleLib" jndiName="jdbc/RPENG_DB">
             <properties.oracle password="password" URL="jdbc:oracle:thin:@//hostname/lib1" user="rpe_user"/>
          </dataSource>
          <dataSource id="DGAAS_DB" jdbcDriverRef="db2-lib" jndiName="jdbc/DGAAS_DB">
             <properties.oracle password="password" URL="jdbc:oracle:thin:@//hostname/lib1" user="rpe_user"/>
          </dataSource>
    請參閱 WebSphere Application Server Liberty 產品說明文件中的在 Liberty 設定檔中配置資料庫連線功能
  7. server.xml 檔中新增下列項目,以啟用 http://server:port/dgaas/debug
    <classloading useJarUrls="true"/>
  8. server.xml 檔中新增下列項目,以便在階段作業管理程式回應未獲授權的要求時,讓階段作業失效,而不是發出 UnauthorizedSessionRequestException 錯誤訊息:
    <httpSession invalidateOnUnauthorizedSessionRequestException="true" cookieSecure="true"></httpSession>
  9. server.xml 檔中新增下列配置。 idname 是選用屬性。 location 屬性不必是完整的,因為依預設 Liberty 會查看 apps 目錄。
    若為 DB2:
    <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>
    若為 Oracle:
    <application type="ear" location="/opt/IBM/WebSphere/Liberty/usr/servers/rpe_oracle/apps/com.ibm.rpe.web.app.ear">
           <classloader apiTypeVisibility="spec, ibm-api, api" commonLibraryRef="rcl" />
          
    如果您已部署 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 設定檔。 執行文件產生之後,所有資產和資料都會儲存在資料庫中。

結果

您可以在瀏覽器中開啟介紹頁面,來確認已部署「文件建置器」:http://server:port/rpeng/
記住: 如果您在 Web 瀏覽器中遇到 UnauthorizedSessionRequestException 錯誤訊息,請驗證您已完成上述步驟,亦即,在 server.xml 檔中新增下列項目:
<httpSession invalidateOnUnauthorizedSessionRequestException="true"></httpSession>

範例

若為 DB2: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>
若為 Oracle: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>
       <feature>ssl-1.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="9445" httpsPort="9082" host="localhost"/>
    <keystore id="defaultKeyStore" password="password"/>
    <classloading useJarUrls="true"/>
   <httpSession cookieSecure="true invalidateOnUnauthorizedSessionRequestException="true"></httpSession>
    <!-- User creation-->
    <basicRegistry id="form" realm="WebRealm">
       <user name="rpe_user" password="xyz" />
       <user name="rpe_designer" password="xyz" />
       <user name="rpe_admin" password="xyz" />
    </basicRegistry>
   <!-- Define licensing Library consumption for RPE  -->
    <application type="ear" location="/opt/IBM/WebSphere/Liberty/usr/servers/rpe_oracle/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_designer" />
          </security-role>
          <security-role name="rpe_admin">
             <user name="rpe_admin" />
          </security-role>
       </application-bnd>
    </application>
   
    <!--Database Configuration -->
    <jdbcDriver id="OracleLib">
       <library>
          <fileset caseSensitive="false" dir="/oracle_jdbc" includes="*.jar">
       </library> 
    </jdbcDriver>
    <dataSource id="rpeng_db" jdbcDriverRef="OracleLib" jndiName="jdbc/RPENG_DB">
       <properties.oracle password="password" URL="jdbc:oracle:thin:@//hostname/lib1" user="rpe_user"/>
    </dataSource>
    <dataSource id="DGAAS_DB" jdbcDriverRef="db2-lib" jndiName="jdbc/DGAAS_DB">
       <properties.oracle password="password" URL="jdbc:oracle:thin:@//hostname/lib1" user="rpe_user"/>
    </dataSource>
</server>

下一步

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

配置 http://server:port/rpeng/ 頁面上所列出的「Rational Publishing Engine 文件建置器。請參閱 「文件建置器」URL,以取得每個 URL 的使用方式及每個特性的配置作業的說明。