准备和运行应用程序客户机
了解如何准备服务器和客户机以从 Liberty 应用程序客户机容器运行应用程序客户机。
关于此任务
成功运行应用程序客户机需要更新 server.xml 和 client.xml 文件。
过程
按如下所示准备服务器:
- 将客户机模块 (.jar) 及其他模块(例如,EJB 模块 (.jar))打包到应用程序 EAR 文件中。
- 将该 EAR 文件放到 apps 目录(例如,wlp/usr/servers/your_server/apps)中。
- 通过添加 appClientSupport-1.0 功能部件及其他必需功能部件来更新 server.xml 配置文件。 要点: 如果应用程序客户机是独立应用程序,那么不需要执行此步骤。
- 通过使用您的应用程序信息配置 <application/> 来更新 server.xml 配置文件;例如:
<?xml version="1.0" encoding="UTF-8"?> <server description="new server"> <!- Enable features -> <featureManager> <feature>javaee-7.0</feature> </featureManager> <application id="techsample" name="techSample" type="ear" location="TechnologySamples.ear"/> </server>
按如下所示准备客户机:
- 将该 EAR 文件放到 apps 目录(例如,wlp/usr/clients/your_client/apps)中。
- 通过使用您的应用程序信息配置 <application/> 来更新 client.xml 配置文件;例如:
<?xml version="1.0" encoding="UTF-8"?> <client description="new client"> <!- Enable features -> <featureManager> <feature>javaeeClient-7.0</feature> </featureManager> <application id="techsample" name="techSample" type="ear" location="TechnologySamples.ear"/> </client>
- 可选: 将 appClientSupport-1.0 功能部件添加至 client.xml 文件。阅读有关手动创建 Liberty 应用程序客户机的信息。
- 启动服务器。
- 通过输入 client run your_client 来运行客户机。 如果客户机应用程序使用命令行自变量,请使用以下格式:
client run {your_client} -- arg1 arg2 ... argn
如果服务器和客户机在不同计算机上运行,那么还需要执行一些额外步骤。缺省情况下,服务器和客户机使用 localhost:2809。必须配置 IIOP 以在服务器与客户机之间建立连接,如下所示:
- 停止服务器。
- 使用 IIOP 配置更新 server.xml 文件;例如:
<iiopEndpoint id="defaultIiopEndpoint" host="user.host.ibm.com" iiopPort="2814" />
- 使用 IIOP 配置更新 client.xml 文件;例如:
<orb id="defaultOrb" nameService="corbaname::user.host.ibm.com:2814" />
- 启动服务器。
子主题
- 手动创建 Liberty 应用程序客户机
可从命令行创建 Liberty 应用程序客户机。 - 创建带有多个客户机模块的 Liberty 应用程序客户机
可在同一 EAR 文件中创建带有多个客户机模块的 Liberty 应用程序客户机。
父主题: 设置 Liberty

文件名:twlp_setup_prepareappclient.html