【深入浅出ADF】部署web应用

推荐查看格式不乱的PDF版本:http://pan.baidu.com/share/link?shareid=1443770336&uk=4146943184

 

 

Author:牟宏迪

muhongdi@gmail.com

Creation date:2013年10月9日

 

 

 

目录

1.    适用范围    3

2.    前言    3

3.    ADF应用部署介绍    3

4.    ADF应用部署流程    3

5.    使用Integrated WebLogic Server部署ADF应用    5

6.    把开发的程序部署到Standalone Application Server    5

7.    怎样创建或扩展Weblogic Domains    6

8.    ADF创建一个Oracle WebLogic Server Domain    6

9.    ADF扩展一个Oracle WebLogic Server Domain    6

10.    ADF设置远程WebLogic Managed Servers    7

11.    怎样为weblogic创建一个JDBC Data Source    9

12.    How to Create a JDBC Data Source for IBM WebSphere Application Server    10

13.    使用Enterprise Manager部署    10

14.    使用脚本命令部署    10

15.    使用脚本或者Ant部署    11

16.    使用Application Server Administration Tool部署    11

17.    Appendix    12

17.1    参考资料    12

17.2    使用IBM WebSphere    12

 

 

适用范围

  • 需要详细了解Jdeveloper部署知识的同学。
  • 如果只是开发用,可直接参考: 5. 使用Integrated WebLogic Server部署ADF应用
  • 部分操作过程使用英语比较直观,因此直接引用的原文

    

前言

本文讲解如何将ADF应用部署到指定的应用服务器上,它描述了如何创建部署配置,如何创建部署描述符,以及如何加载ADF的运行时库。

 

讲解如何使用Jdeveloper自带的Integrated WebLogic Server进行开发时部署。

 

讲解如何创建一个JDBC数据源

 

ADF应用部署介绍

部署是一个将应用程序的文件打包并传送到服务器端运行的过程。开发人员可以在开发的过程中使用Jdeveloper内嵌的weblogic(Integrated WebLogic Server)或独立的standalone application server进行部署。

当应用被开发完成,管理员就可以将其部署到生产环境了,管理员可用的生产级别的部署工具有:

  • Oracle Enterprise Manager Fusion Middleware Control
  • WebLogic Scripting Tool (WLST) commands or WebSphere Application Server (wsadmin) commands
  • Command scripts and Ant scripts
  • Oracle WebLogic Administration Console or WebSphere Administrative Console

 

 

ADF应用部署流程

下面是ADF应用部署流程图

 

对于weblogic的配置,有如下要点:

  • 在weblogic安装ADF运行时之后,你可以创建一个新的domain,或者你可以扩展一个domain。
  • 如果你的Administration Server与 Managed Servers不属于同一个host,你需要对Managed Servers进行额外配置才能使用ADF应用。
  • ADF应用可以使用JDBC数据源或JDBC URL来获取其数据,你可以在weblogic的Admin Console中配置数据源。

 

 

使用Integrated WebLogic Server部署ADF应用

如果你正在使用Jdeveloper开发应用,那么你不需要单独安装Weblogic Server,也不需要为weblogic配置ADF运行时,只要在Jdeveloper的菜单中点击Run即可创建weblogic对应的domain。

 

 

把开发的程序部署到Standalone Application Server

如果您想把应用部署到Standalone Application Server(如weblogic、websphere)来更好的模拟生产环境下的运行。

 

  • 通常,使用如下步骤来进行部署:
  • 创建一个连接到server的connection
  • 创建部署配置文件(如果需要)
  • 创建部署描述符(只有特定的目标应用服务器才需要)
  • 更新application.xml和web.xml来兼容server
  • 修改web.xml来启用Real User Experience Insight (RUEI) (如果需要)
  • 迁移application-level security policy data为domain-level security policy store
  • 如果要使用Oracle Single Sign-On(Oracle SSO)的话,修改domain中的jps-config.xml文件中的配置

 

你必须已经拥有一个application server。你可以使用Oracle 11g Installer或Oracle Fusion Middleware 11g Application Developer Installer来安装Weblogic。

 

关于Weblogic的配置,需要查看这个文档:

"Preparing the Standalone Application Server for Deployment" section of the Oracle Fusion Middleware Administrator's Guide for Oracle Application Development Framework

 

怎样创建或扩展Weblogic Domains

你需要创建并配置 WebLogic Server domain来兼容ADF应用,如果你还没有domain,你需要建一个,如果你已经有了一个domain,你必须扩展(Extend)它,才能运行ADF应用。

如果你正在运行Managed Servers来运行你的应用,你需要配置Managed Server,配置方法详见: Oracle Fusion Middleware Creating Domains Using the Configuration Wizard.

如果你想让你的 Managed Servers可以运行ADF应用,并且你的Managed Servers与Administration Server属于同一个host,使用如下方法。

如果你想设置一个与Administration Server不属于同一个host的 Managed Servers,请查看如下文档: Section 2.2.2.3, "Setting Up Remote WebLogic Managed Servers for Oracle ADF."

 

为ADF创建一个Oracle WebLogic Server Domain

  1. Start the Oracle Fusion Middleware Configuration wizard
  2. In the Welcome page, select Create a New WebLogic Domain and click Next.
  3. In the Select Domain Source page, select Generate a domain configured automatically to support the following products.
  4. The option Basic WebLogic Server Domain (Required) is already selected.
  5. Select Oracle JRF. If you are using Oracle Web Services, select Oracle WSM Policy Manager and click Next.

 

为ADF扩展一个Oracle WebLogic Server Domain

  1. Start the Oracle Fusion Middleware Configuration wizard as described in the " Configuring Application Developer" chapter of the Oracle Fusion Installation Guide for Application Developer.
  2. Follow the directions as described in that guide but consider the following steps.
  3. In the Welcome page, select  Extend an existing WebLogic domain and click  Next.
  4. In the Select a WebLogic Domain Directory page, select the location of the domain you want to configure for Oracle ADF, and click  Next.
  5. In the Select Extension Source page, select  Extend my domain automatically to support the following added products.
  6. The option  Basic WebLogic Server Domain (Required) is already selected.
  7. Select  Oracle JRF. If you are using Oracle Web Services, select  Oracle WSM Policy Manager and click  Next.

 

This configures the rest of the runtime .jar files using the manifest file.

 

Note:

Your application's EAR file must have a weblogic-application.xml file containing a reference to the adf.oracle.domain shared library.

You can now start Oracle WebLogic Server by running the command-line script ORACLE_HOME\user_projects\domains\domain_name\bin\startWebLogic.cmd, and you can stop the server using the stopWebLogic.cmd script in the same directory. For Linux platforms, use \bin\startWebLogic.sh and stopWebLogic.sh respectively.

Access the Oracle WebLogic Server Administration Console using the URL http://localhost:7001/console.

为ADF设置远程WebLogic Managed Servers

你需要通过Administration Server设置 Managed Servers ,打包JRF template,将其复制到远程host,并解压template。

具体步骤:

  1. 使用 Oracle Installer for JDeveloper 在local和remote host来安装weblogic,如果你不打算安装JDeveloper Studio,你需要在安装时选择 Application Development Framework Runtime选项。 local host就是Administration Server所在的host。

 

或者,如果已经存在安装过的weblogic,可以使用Oracle Installer for JDeveloper并通过选择Application Development Framework Runtime来来为weblogic安装ADF运行时(ADF runtime)。

 

  1. 运行 Oracle Fusion Middleware Configuration Wizard来创建一个Oracle WebLogic Server domain,在向导中选择 Oracle JRF选项。详见:   Section 2.2.2.1, "Creating an Oracle WebLogic Server Domain for Oracle ADF."

 

  1. 在 local host,运行Oracle Fusion Middleware Configuration Wizard 来创建 Managed Servers

 

  1. 在 local host, 运行Administration Server 与 Managed Server.

 

For example,

cd ORACLE_HOME/user_projects/domain/base_domain/bin

./startWeblogic.sh

./startManagedWebLogic.sh ManagedServer_1 http://localhost:7001

  1. 在local host, 打包Managed Server configuration information为一个 JAR 然后复制JAR到远程host. 这个JAR包含JRF template信息.

For example,

cd ORACLE_HOME/oracle_home/common/bin

 

./pack.sh -managed=true -domain=../../../user_projects/domains/base_domain

-template=../../../base_domain_managed.jar -template_name=

"Base Managed Server Domain"

 

cp ../../../base_domain_managed.jar remote_machine_ORACLE_HOME/

 

  1. 在远程host,解压Managed Server配置JAR.

For example,

cd ORACLE_HOME/oracle_common/common/bin

./unpack.sh -domain=../../../user_projects/domains/base_domain

-template=../../../base_domain_managed.jar

如果Managed Server实在domain创建之后创建的,你需要在解压之前删除ManagedServer的整个domain配置目录

  1. 在远程host, 运行Node Manager .

For example,

cd ORACLE_HOME/wlserver_10.3/server/bin

./startNodeManager.sh

 

  1. On the remote host, if the Managed Server was not created with the JRF template applied, run the  applyJRF WLST command to extend the Managed Server with the JRF template.
  2. 在远程host,如果Managed Server不是基于JRF template创建的,运行applyJRF WLST 命令来扩展Managed Server。

    另外,如果Managed Server不是在domain创建之后创建的,你需要在运行applyJRF前删除Managed Server的整个domain配置目录。

  3. 同时在所有hosts运行Managed Servers。

For example,

cd ORACLE_HOME/user_projects/domains/base_domain/bin./startManagedWebLogic.sh ManagedServer_2 http://<adminServerHost>:7001

 

 

怎样为weblogic创建一个JDBC Data Source

在Weblogic Server实例中使用Weblogic Administration Console来创建一个JDBC数据源

  • 启动 Oracle WebLogic Server (如果还没有启动) 从开始菜单中选择  Oracle Fusion Middleware > User Projects > Domain > Start Admin Server for WebLogic Server Domain 

Linux系统需要使用root或有对应权限的用户运行:

<ORACLE_HOME>/user_projects/domains/MYSOADomain/bin/startWebLogic.sh

或从Application Server Navigator右键点击一个Oracle WebLogic Server实例,然后选择Launch Admin Console

  • 登陆WebLogic Server Administration Console.
  • 在WebLogic Server Administration Console页面,选择 JDBC > Data Sources.
  • 点击 New.
  • 在 JDBC Data Source Properties页面:
    • Name栏位输入JDBC data source.
    • JNDI栏位,以 jdbc/connectionDS的格式输入JNDI名称.
    • Database Type, 选择  Oracle.
    • Database Driver, 选择  Oracle Driver (thin), 然后  Next.
  • 在Transactions Options页面,使用默认设置并点击 Next.
  • 在Connection Properties页面:
    • Database Name,输入Oracle SID. 如,  orcl.
    • Host Name,输入数据库的机器名称.
    • 输入端口号.
    • 输入用户密码点击  Next.
  • 在Test Database Connection 页面点击  Test Configuration.
  • 在Select Targets 页面,选择JDBC数据源要部署到哪个Server上。
  •   Finish.

一旦weblogic数据源被建立,它就可被用于所有应用模块(application module)。

 

How to Create a JDBC Data Source for IBM WebSphere Application Server

To configure a JDBC data source for WebSphere Application Server, see the Oracle Fusion Middleware Third-Party Application Server Guide.

 

使用Enterprise Manager部署

你可以使用EM(Oracle Enterprise Manager Fusion Middleware Control)来部署JDeveloper生成的EAR文件。EM是一个BS、图形化的用户界面,你可以用它来监控和管理一个Farm。更多信息: Oracle Fusion Middleware Administrator's Guide.

 

使用脚本命令部署

应用或者模块可以在不打开JDeveloper的情况下进行部署,你可以从cmd或脚本来运行WLST commands  (for WebLogic) 或 wsadmin commands (for WebSphere Application Server) 。

在部署application (EAR) 或 project (JAR or WAR)之前,你需要提供部署配置(deployment profiles)。JDeveloper会自动为指定类型的应用创建这些部署配置,但是在执行部署之前,需要验证下部署配置文件是否存在,验证方法为在JDeveloper中选择Deployment(从应用或Project均可),详细信息可查看Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

JDeveloper也可以用来部署应用的EAR,WAR或JAR文件。同一个脚本即被用来通过命令行执行,也被JDeveloper用来通过图形化方式运行。

 

ADF应用有一些特殊的WLST 命令 (WebLogic)。这里是这些命令的列表:Chapter 4, "WLST Command Reference for ADF Applications."

 

更多关于使用WLST脚本的信息,请看Oracle Fusion Middleware WebLogic Scripting Tool Command Reference.

 

 

使用脚本或者Ant部署

你可以使用命令或脚本进行部署。你使用ojdeploy命令来创建一个部署脚本,同时使用ojaudit命令来提交(auit)projects,workspaces或应用程序的源文件。你也可以设置应用程序为当有程序员提交新程序时自动运行编译脚本。

ojdeploy脚本与Ant脚本可以独立或者分开使用:

  1. Create an  ojdeploy script to compile, package, and deploy the application.
  2. Create an  ojdeploy script to compile and package the application. Then use an Ant script (such as  WLDeploy) to deploy the application.
  3. Create an Ant script to compile, package, and deploy the application. The Ant does not need to use  ojdeploy.

For more information about the ojdeploy and ojaudit commands, see the JDeveloper online help.

You can deploy to most application servers from JDeveloper, or use tools provided by the application server vendor. You may also use Ant to package and deploy applications. The build.xml file, which contains the deployment commands for Ant, may vary depending on the target application server.

For deployment to other application servers, see the application server's documentation. If your application server does not provide specific Ant tasks, you may be able to use generic Ant tasks. For example, the generic eartask creates an EAR file for you.

For information about Ant, see http://ant.apache.org.

使用Application Server Administration Tool部署

For WebLogic, you can use the Oracle WebLogic Server Administration Console to deploy the EAR file created in JDeveloper. For more information, see Oracle Fusion Middleware Deploying Applications to Oracle WebLogic Server.

For WebSphere Application Server, you can use the IBM WebSphere Administrative Console to deploy the EAR file created in JDeveloper. For more information, go to the WebSphere Application Server Information Center at: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.home.doc/welcome.html.

 

 

Appendix

  • 参考资料

http://docs.oracle.com/cd/E16162_01/admin.1112/e16179/deploy.htm#ADFAG20791

http://docs.oracle.com/cd/E16162_01/admin.1112/e16179/deploy.htm#ADFAG101

 

  • 使用IBM WebSphere

关于如何使用IBM WebSphere,请参考Oracle? Fusion Middleware Third-Party Application Server Guide

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值