Red Hat Training

A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform

第 2 章 准备迁移

2.1. 准备工作概述

In JBoss EAP 7, an effort was made to provide backward compatibility for JBoss EAP 6 applications. However, if your application uses features that were deprecated or functionality that was removed from JBoss EAP 7, you might need to make changes to your application code.

In addition, a number of things have changed in this release that might impact deployment of JBoss EAP 7 applications. It is recommended that you do some research and planning before you attempt to migrate your application.

一旦您了解了这些功能的变化、开发内容及可以协助您迁移的工具,您就可以开始评估应用程序和服务器配置来确定在 JBoss EAP 7 里运行所需的修改。

2.2. 查看 Java EE 7 的功能

Java EE7 包含了许多使得在私有和公共云上开发和运行功能丰富的应用程序更容易的改进。它合并了新的功能及最新的标准,如 HTML5、WebSocket、JSON、Batch 和 Concurrency Utilities。更新还包含了 JPA 2.1、JAX-RS 2.0、Servlet 3.1、Expression Language 3.0、JMS 2.0. JSF 2.2、EJB 3.2、CDI 1.2 和 Bean Validation 1.1。

您可以在 Oracle 的网站找到关于 Java EE 的更多信息,其中包括教程:Java EE at a Glance

2.3. 查看 JBoss EAP 7 里的新功能

与之前的版本相比,JBoss EAP 7 包含了显著的升级和改进。

Java EE 7
JBoss EAP 7 是一个已认证的 Java EE 7 Full 和 Web 配置规格的实现。它也包括对最新的 CDI 1.2 和 Web Sockets 1.1 的支持。
Undertow
Undertow 是 JBoss EAP 7 里包含的新的轻量级的、高性能的 Web 服务器。它是用 Java 编写的,专门为高吞吐量和扩充性而设计的。它支持最新的 Web 技术,如新的 HTTP/2 标准。
Apache ActiveMQ Artemis
Apache ActiveMQ Artemis 是 JBoss EAP 7 的新的内置消息供应商。基于 HornetQ 代码的捐献,这个 Apache 子项目提供了基于非阻塞式架构的突出性能。
IronJacamar 1.2
最新的 IronJacamar 提供了对 JCA 和数据源的稳定的、功能丰富的支持。
JBossWS 5
The fifth generation of JBossWS is a major leap forward, bringing new features and performance improvements to JBoss EAP 7 web services.
RESTEasy 3
JBoss EAP 7 包含了最新的 RESTEasy。通过提供大量的有用扩展,如 JSON Web Encryption、Jackson、YAML、JSON-P 和 Jettison,它超出了标准的 Java EE REST API(JAX-RS 2.0)。
OpenJDK ORB
JBoss EAP 7 用 OpenJDK ORB 的一个下游分支替换了 JacORB IIOP,从而实现了与 JVM ORB 和 Java EE RI 的更好的互用性。
功能丰富的群集
JBoss EAP 7 很大程度地重构了对群集的支持,它包含了应用程序可以访问的几个公用 API。
端口的减少
利用 HTTP 升级,JBoss EAP 7 对几乎所有的协议都使用两个端口的多路复用:管理端口(9990)和应用程序端口(8080):
日志的增强
管理 API 现在支持列出和查看服务器上的可用日志文件,甚至定义默认模式格式器之外的自定义格式器。部署的日志设置也大大地增强了。

For a complete list of new features, see New Features and Enhancements in the JBoss EAP 7 Release Notes.

2.4. 查看已舍弃和不被支持的功能的列表

Before you migrate your application, be aware that some features that were available in previous releases of JBoss EAP might be deprecated or no longer supported.

由于维护成本高、社区不感兴趣以及更好的替代方案的出现,我们取消了对一些技术的支持。下面是对不再支持的功能的概述。

EJB Entity Bean
我们不再支持 EJB Entity Bean。如果您的应用程序使用了 EJB Entity Bean,您应该迁移至提供灵活的 API 及更好性能的 JPA。
JAX-RPC
因为 JAX-WS 提供了更正确和完整的解决方案,根据 JAX-RPC 编写的代码应该迁移至 JAX-WS。
JSR-88
Java EE 应用程序部署 API 规格(JSR-88)定义了启用多个提供者的工具在任何 Java EE 平台产品上配置和部署应用程序的合约。您必须使用另外一个 JBoss EAP 支持的选项进行应用程序部署,如管理控制台、管理 CLI、部署扫描器或 Maven。
通用的 JMS 资源适配器
JBoss EAP 7 不再支持配置通用的 JMS 资源适配器来连接 JMS 供应商。

For a comprehensive list of deprecated and unsupported features, see Unsupported and Deprecated Functionality in the JBoss EAP 7 Release Notes.

2.5. 浏览《JBoss EAP 7 起步指南》的内容

Be sure to review the JBoss EAP Getting Started Guide. It contains the following important information:

  • 如何下载和安装 JBoss EAP 7
  • 如何下载和安装 Red Hat JBoss Developer Studio
  • 如何为您的开发环境配置 Maven,管理项目依赖关系和配置项目使用 JBoss EAP Bill of Material (BOM) 购件。
  • 如何下载和运行产品附带的 Quickstart 例程。

2.6. 迁移分析和规划

Each application and server configuration is unique and you must thoroughly understand the components and architecture of the existing application and server platform before you attempt the migration. Your migration plan should include a detailed roadmap for testing and roll out to production that takes into account the following information.

确定负责迁移的人员
确定利益关系人、项目经理、开发人员、管理员和其他负责迁移的人员。
复查应用服务器平台配置和硬件

检查现有的应用服务器和平台配置来确定 JBoss EAP 7 里的功能变动如何影响它们。这种检查应该包含下列项目。

  • 操作系统和版本
  • 应用程序使用的数据库
  • Web 服务器
  • 安全架构
  • 处理器的数量和类型
  • 内存数量
  • 物理磁盘空间的大小
  • 数据库或消息数据的迁移
  • Other components that might be impacted by the migration
复查当前的产品环境

您应该计划为测试和模拟迁移过程创建和产品环境尽可能相同的环境。

  • Take into account any clustering configurations. See Upgrading a Cluster in the JBoss EAP Patching and Upgrading Guide for more information about how to migrate clusters.
  • 如果您目前运行的是大型的受管域,请考虑渐进式迁移方法。
  • 确定您是否需要迁移任何数据库或消息数据。
检查和了解现有的应用程序

彻底检查现有的 JBoss EAP 6 应用程序。充分熟悉它的架构、功能、特点和组件,其中包括:

  • JVM 版本
  • 与其他 Red Hat 应用服务器中间件组件的集成
  • 与第三方私有软件的集成
  • 需要替换的已舍弃的功能
  • 应用程序配置,包括部署描述符文件、JNDI、持久化、JDBC 配置和池、JMS 主题和队列和日志。

确认在迁移至 JBoss EAP 7 的过程中需要修改的任何代码或配置的不兼容性。

创建详细的测试计划
  • 这个计划应该包括回归测试和验收标准要求。
  • 它也应该包含性能测试。
  • 在产品环境试运行之前,设置和产品环境尽量相同的模拟环境以测试迁移过程。
  • 请确保创建了备份和回滚计划!
查看迁移过程中的可用资源
  • 评估开发团队的技能并规划培训或其他的咨询协助。
  • 请意识到在迁移过程中进行模拟和测试可能要求额外的硬件和其他资源。
  • 确定是否需要任何正式的培训。如果是,将其添加至时间表里。
执行计划
收集必要的资源并实施迁移计划。
重要

在修改应用程序之前,请确保已进行了备份。

2.7. 备份重要数据并复查服务器状态。

在您迁移应用程序前,您应该意识到下列一些潜在的问题。

  • The migration might remove temporary folders. Any deployments stored in the data/content/ directory must be backed up prior to the migration and restored after it completes. Otherwise, the server will fail to start due to the missing content.
  • 在迁移之前,处理任何打开的事务并删除 data/tx-object-store/ 事务目录。
  • 您必须检查 data/timer-service-data 里的持久性定时器数据来确定是否兼容。在迁移之前,复查该目录里的 deployment-* 文件以确定哪些定时器仍在使用。

在您开始前请确保也备份当前服务器配置和应用程序。

2.8. 迁移和 RPM 安装

重要

单个 Red Hat Enterprise Linux 服务器上不支持多个以 RPM 方式安装的 JBoss EAP 实例。因此,我们推荐您在迁移至 JBoss EAP 7 时将 JBoss EAP 安装迁移到新的主机。

在将 JBoss EAP RPM 安装从 JBoss EAP 6 迁移至 JBoss EAP 7 时,请确保 JBoss EAP 7 安装在没有现存 JBoss EAP RPM 安装的主机上。

To install JBoss EAP 7 using RPMs, see the JBoss EAP Installation Guide.

The migration advice in this guide also applies to migrating RPM installations of JBoss EAP, but you might need to alter some steps (such as how to start JBoss EAP) to suit an RPM installation compared to a ZIP or installer installation.

2.9. 迁移作为服务运行的 JBoss EAP

If you run JBoss EAP 6 as a service, be sure to review Configuring JBoss EAP to Run as a Service in the JBoss EAP Installation Guide for updated configuration instructions for JBoss EAP 7.