WebSphere Application Server Liberty 概要文件上部署 Web 应用程序

可以在带有 IBM® DB2®WebSphere® Application Server Liberty 上部署 Rational® Publishing Engine Web 应用程序。

开始之前

在部署 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. 为 Web 应用程序创建具有 16K 页面和 UTF-8 代码集的数据库。 请参阅 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. 通过将 rpeng 数据源和 dgaas 数据源的 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 文件,那么需要添加的应用程序条目是两个而不是一个:
    <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>

示例

配置了 server.xml 文件示例以部署 Web 应用程序:
<?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 的用法说明以及用于配置每项功能部件的任务。