IBM PC
Linux RedHat 9.0
IP:127.0.0.1 PORT:7001
Administrator Server
IBM PC
Linux RedHat 9.0
IP:127.0.0.1 PORT:8888
Apache Server
IBM PC
Linux RedHat 9.0
IP:127.0.0.1 PORT:7002
Managed Server Node_A
IBM PC
Linux AS 3
IP:10.116.5.55 PORT:7004
Managed Server Node_B
4.2. 所需软件
Apache 2.0:httpd-2.0.48.tar.gz
SUN JDK1.4:j2sdk-1_4_2_10-linux-i586.bin
BEA WebLogic Sever 8.1 SP4:pj_server814_generic.jar
BSS系统应用程序包:applications.tar.gz
4.3. 创建用户
为方便管理,创建安装weblogic软件的用户以及运行weblogic实例的用户
4.4. 安装Apache并与weblogic集成
以root用户解压httpd-2.0.48.tar.gz并安装:
#cd /data
#tar –zxvf httpd-2.0.48.tar.gz
#cd httpd-2.0.48
#./configure ――enable-module=so ――enable-rule=SHARED_CORE
#make
#make INSTALL
Apache已安装到/usr/local/apache2。
4.5. 安装JDK
安装文件j2sdk-1_4_2_10-linux-i586.bin
$chmod a+x j2sdk-1_4_2_10-linux-i586.bin
$./ j2sdk-1_4_2_10-linux-i586.bin
安装完成。
4.6. 安装weblogic
安装文件pj_server814_generic.jar
$ java -jar pj_server814_generic.jar -mode=console
安装过程中创建安装路径为/data/weblogic814
其他按照提示安装即可。
4.7. apache与weblogic的集成
下面开始进行apache与weblogic的集成:
查看apache是否可以与weblogic集成
$cd /usr/local/apache2/bin
$./httpd –l
Compiled in modules:
core.c
mod_access.c
mod_auth.c
mod_include.c
mod_log_config.c
mod_env.c
mod_setenvif.c
prefork.c
http_core.c
mod_mime.c
mod_status.c
mod_autoindex.c
mod_asis.c
mod_cgi.c
mod_negotiation.c
mod_dir.c
mod_imap.c
mod_actions.c
mod_userdir.c
mod_alias.c
mod_so.c
mod_so.c表明当前的Apache HTTP Server是动态加载的模式,可以和WebLogic进行集成。然后将/data/weblogic814/server/lib/linux/i686目录下的mod_wl_20.so文件拷贝到/usr/local/apache2/modules/目录下面:
$cp /data/weblogic814/server/lib/linux/i686/mod_wl_20.so /usr/local/apache2/modules/
修改/usr/local/apache2/conf/httpd.conf:
$cd /usr/local/apache2/conf/
$vi httpd.conf
添加LoadModule weblogic_module modules/mod_wl_20.so
及
<VirtualHost 127.0.0.1:8888>
ServerName 127.0.0.1
<IfModule mod_weblogic.c>
WebLogicCluster 127.0.0.1:7002,10.116.5.55:7004
MatchExpression *.*
</IfModule>
</VirtualHost>
然后重启apache
$/usr/local/apache2/bin/httpd –k restart
4.8. 配置weblogic集群
$cd /data/weblogic814/common/bin
$./config.sh
Unable to instantiate GUI, defaulting to console mode.
<-------- BEA WebLogic Configuration Wizard -------->
Create or Extend a Configuration:
---------------------------------
Choose between creating and extending a configuration. Based on your selection, the Configuration Wizard guides you through
the steps to generate a new or extend an existing configuration.
->1|Create a new WebLogic configuration
| Start here to create a WebLogic configuration in your projects directory.
2|Extend an existing WebLogic configuration
| Start here to extend an existing WebLogic configuration. Use this option to add applications and services,
|including Database access (JDBC) and Messaging (JMS). This option also enables you to extend functionality by enabling
|WebLogic Workshop.
Enter index number to select OR [Exit][Next]>1 #选择1
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Select a Domain Template:
-------------------------
Please select a template from the list or select another directory of templates.
* [/data/weblogic814/common/templates/domains]
1|Basic WebLogic Workshop Domain 8.1.4.0
| BEA Systems, Inc.
| Create a basic WebLogic Workshop domain, without installing sample applications. Domains created from this template |will support the WebLogic Server and WebLogic Workshop runtime functionality, including support for J2EE applications,
|Web applications, Web Services and custom controls. Use domains created from this template for development of WebLogic |Workshop applications.
->2|Basic WebLogic Server Domain 8.1.4.0
| BEA Systems, Inc.
| Create a basic WebLogic Server domain without installing sample applications.
3|WebLogic Server Examples Domain 8.1.4.0
| BEA Systems, Inc.
| Create the WebLogic Server Examples domain in a directory outside of the installed kit. The Examples domain contains |a collection of examples to show best practices for coding individual J2EE APIs.
4|Avitek Medical Records Sample Domain 8.1.4.0
| BEA Systems, Inc.
| Create the Avitek Medical Records domain in a directory outside of the installed kit. The Avitek Medical Records is
|a WebLogic Server sample application suite that concisely demonstrates all aspects of the J2EE platform.
5|Select another directory location
Enter index number to select OR [Exit][Previous][Next]>2 #选择2
<------- BEA WebLogic Configuration Wizard --------->
Choose Configuration Option:
----------------------------
*Do you want to run the wizard in express mode?
->1|Yes
2|No
Enter index number to select OR [Exit][Previous][Next]>2 #选择2
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure the Administration Server:
------------------------------------
Enter adminstration server configurations. Each WebLogic Server domain must have one Administration Server. The
Administration Server hosts the Administration Console which is used to perform administrative tasks.
| Name | Value |
_|__________________|_____________________|
1| *Name: | myserver |
2| Listen address: | All Local Addresses |
3| Listen port: | 7001 |
4| SSL listen port: | N/A |
5| SSL enabled: | false |
Select Option:
1 - Modify "Name"
2 - Modify "Listen address"
3 - Modify "Listen port"
4 - Modify "SSL enabled"
Enter option number to select OR [Exit][Previous][Next]>1 #选择1
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure the Administration Server:
------------------------------------
Enter adminstration server configurations. Each WebLogic Server domain must have one Administration Server. The
Administration Server hosts the Administration Console which is used to perform administrative tasks.
| Name | Value |
_|__________________|_____________________|
1| *Name: | myserver |
2| Listen address: | All Local Addresses |
3| Listen port: | 7001 |
4| SSL listen port: | N/A |
5| SSL enabled: | false |
Enter value for "Name" OR [Exit][Previous][Next]>adminserver #配置管理服务名为adminserver
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure the Administration Server:
------------------------------------
Enter adminstration server configurations. Each WebLogic Server domain must have one Administration Server. The
Administration Server hosts the Administration Console which is used to perform administrative tasks.
| Name | Value |
_|__________________|_____________________|
1| *Name: | adminserver |
2| Listen address: | All Local Addresses |
3| Listen port: | 7001 |
4| SSL listen port: | N/A |
5| SSL enabled: | false |
Select Option:
1 - Modify "Name"
2 - Modify "Listen address"
3 - Modify "Listen port"
4 - Modify "SSL enabled"
5 - Discard Changes
Enter option number to select OR [Exit][Previous][Next]>2 #选择2设置监听地址
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure the Administration Server:
------------------------------------
Enter adminstration server configurations. Each WebLogic Server domain must have one Administration Server. The
Administration Server hosts the Administration Console which is used to perform administrative tasks.
| Name | Value |
_|__________________|_____________________|
1| *Name: | adminserver |
2| Listen address: | All Local Addresses |
3| Listen port: | 7001 |
4| SSL listen port: | N/A |
5| SSL enabled: | false |
Enter value for "Listen address" OR [Exit][Previous][Next]> 127.0.0.1 #输入监听地址
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure the Administration Server:
------------------------------------
Enter adminstration server configurations. Each WebLogic Server domain must have one Administration Server. The
Administration Server hosts the Administration Console which is used to perform administrative tasks.
| Name | Value |
_|__________________|_____________|
1| *Name: | adminserver |
2| Listen address: | 127.0.0.1 |
3| Listen port: | 7001 |
4| SSL listen port: | N/A |
5| SSL enabled: | false |
Select Option:
1 - Modify "Name"
2 - Modify "Listen address"
3 - Modify "Listen port"
4 - Modify "SSL enabled"
5 - Discard Changes
Enter option number to select OR [Exit][Previous][Next]>Next #下一步
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Choose Configuration Option:
----------------------------
*Do you want to configure Managed Servers, Clusters and Machines?
1|Yes
->2|No
Enter index number to select OR [Exit][Previous][Next]> 1 #选择配置被管服务器、集群
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure Managed Servers:
--------------------------
Add or delete configuration information for managed servers. A typical production environment has one or more managed
servers. Each managed server is an instance of WebLogic Server used to host enterprise applications.
| Name* | Listen address | Listen port | SSL listen port | SSL enabled |
_|_______|________________|_____________|_________________|_____________|
Enter name for a new Server OR [Exit][Previous][Next]>node_A #设置被管服务器node_A
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure Managed Servers:
--------------------------
Add or delete configuration information for managed servers. A typical production environment has one or more managed
servers. Each managed server is an instance of WebLogic Server used to host enterprise applications.
| Name* | Listen address | Listen port | SSL listen port | SSL enabled |
_|________|_____________________|_____________|_________________|_____________|
->1| node_A | All Local Addresses | 7001 | N/A | false |
Select Option:
1 - Modify "Name"
2 - Modify "Listen address"
3 - Modify "Listen port"
4 - Modify "SSL enabled"
5 - Done
Enter option number to select OR [Exit][Previous][Next]>2 #设置监听地址
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure Managed Servers:
--------------------------
Add or delete configuration information for managed servers. A typical production environment has one or more managed
servers. Each managed server is an instance of WebLogic Server used to host enterprise applications.
| Name* | Listen address | Listen port | SSL listen port | SSL enabled |
_|________|________________|_____________|_________________|_____________|
->1| node_A | 127.0.0.1 | 7001 | N/A | false |
Select Option:
1 - Modify "Name"
2 - Modify "Listen address"
3 - Modify "Listen port"
4 - Modify "SSL enabled"
5 - Done
Enter option number to select OR [Exit][Previous][Next]>3 #设置监听端口为7002
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure Managed Servers:
--------------------------
Add or delete configuration information for managed servers. A typical production environment has one or more managed
servers. Each managed server is an instance of WebLogic Server used to host enterprise applications.
| Name* | Listen address | Listen port | SSL listen port | SSL enabled |
_|________|________________|_____________|_________________|_____________|
->1| node_A | 127.0.0.1 | 7002 | N/A | false |
Select Option:
1 - Modify "Name"
2 - Modify "Listen address"
3 - Modify "Listen port"
4 - Modify "SSL enabled"
5 - Done
Enter option number to select OR [Exit][Previous][Next]>5 #完成设置node_A
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure Managed Servers:
--------------------------
Add or delete configuration information for managed servers. A typical production environment has one or more managed
servers. Each managed server is an instance of WebLogic Server used to host enterprise applications.
| Name* | Listen address | Listen port | SSL listen port | SSL enabled |
_|________|________________|_____________|_________________|_____________|
->1| node_A | 127.0.0.1 | 7002 | N/A | false |
Select Option:
1 - Add Server
2 - Modify Server
3 - Delete Server
4 - Discard Changes
Enter option number to select OR [Exit][Previous][Next]>1 #设置被管服务器node_B
按照node_A的设置方法完成node_B的创建,监听地址设为10.116.5.55,监听端口7004。
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure Managed Servers:
--------------------------
Add or delete configuration information for managed servers. A typical production environment has one or more managed
servers. Each managed server is an instance of WebLogic Server used to host enterprise applications.
| Name* | Listen address | Listen port | SSL listen port | SSL enabled |
_|________|________________|_____________|_________________|_____________|
1| node_A | 127.0.0.1 | 7002 | N/A | false |
->2| node_B | 10.116.5.55 | 7004 | N/A | false |
Select Option:
1 - Add Server
2 - Modify Server
3 - Delete Server
4 - Discard Changes
Enter option number to select OR [Exit][Previous][Next]>Next #下一步
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure Clusters:
-------------------
A cluster contains multiple WebLogic Server instances (servers) that run simultaneously and work together to provide
increased scalability and reliability. A cluster appears to be a single WebLogic Server instance to clients.
| Name* | Multicast address | Multicast port | Cluster address |
_|_______|___________________|________________|_________________|
Enter name for a new Cluster OR [Exit][Previous][Next]>testcluster
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure Clusters:
-------------------
A cluster contains multiple WebLogic Server instances (servers) that run simultaneously and work together to provide
increased scalability and reliability. A cluster appears to be a single WebLogic Server instance to clients.
| Name* | Multicast address | Multicast port | Cluster address |
_|_____________|___________________|________________|_________________|
->1| testcluster | 237.0.0.1 | 7001 | |
Select Option:
1 - Modify "Name"
2 - Modify "Multicast address"
3 - Modify "Multicast port"
4 - Modify "Cluster address"
5 - Done
Enter option number to select OR [Exit][Previous][Next]> 5 #组播地址和端口设为默认值。
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Assign Servers to Clusters:
---------------------------
Assign managed servers to a cluster in the domain.
Cluster
|_____testcluster [1]
Enter number exactly as it appears in brackets to toggle selection OR [Exit][Previous][Next]>1 #添加被管服务器到集群testcluster中
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Assign Servers to Clusters:
---------------------------
Assign managed servers to a cluster in the domain.
*Select WebLogic Servers and assign them to a cluster. testcluster
1|node_A
2|node_B
Select Option:
1 - Select
2 - Select All
Enter option number to select OR [Exit][Discard][Accept]> 2 #选择所有被管服务器
接下来的几步是创建machines、JDBC、JMS,在此不创建,直接回车。
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Configure Administrative Username and Password:
-----------------------------------------------
Create a user automatically assigned to the Administrative Role. This user is the default administrator used to start
development mode servers.
| Name | Value |
_|_________________________|_________________________________|
1| *User name: | weblogic |
2| *User password: | |
3| *Confirm user password: | |
4| Description: | The default administration user |
Select Option:
1 - Modify "User name"
2 - Modify "User password"
3 - Modify "Confirm user password"
4 - Modify "Description"
Enter option number to select OR [Exit][Previous][Next]>2 #创建管理员密码
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Domain Mode Configuration:
--------------------------
Enable Development or Production Mode for this domain.
->1|Development Mode
2|Production Mode
Enter index number to select OR [Exit][Previous][Next]>1 #配置实例为开发模式
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Java SDK Selection:
-------------------
->1|Other Java SDK
Enter index number to select OR [Exit][Previous][Next]> 1 #选用SUN JDK
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Java SDK Selection:
-------------------
"JVM Directory" = []
Input new JVM Directory OR [Exit][Previous][Next]>/data/j2sdk1.4.2_10
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Select the target domain directory for this configuration:
----------------------------------------------------------
"Target Location" = [/data/weblogic814/user_projects/domains]
Input new Target Location OR [Exit][Previous][Next]>/data/test #输入域目录
<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->
Edit Domain Information:
------------------------
| Name | Value |
_|________|__________|
1| *Name: | mydomain |
Enter value for "Name" OR [Exit][Previous][Next]>bsstest #输入域名
按照以上步骤在10.116.5.55上创建域mydomain以及被管服务器node_B。
至此weblogic域创建成功。
5. 测试环境搭建
5.1. 上载BSS系统程序
为方便管理,将管理服务器和被管服务器放置在不同目录:
在127.0.0.1上将weblogic实例/data/test/bsstest copy至/data/test/ 并重命名为node_A,在10.116.5.55上将weblogic实例/data/test/bsstest重命名为node_B。
对应目录如下:
127.0.0.1 /data/test/adminserver #管理服务器
/data/test/node_A #被管服务器A
10.116.5.55 /data/test/node_B #被管服务器B
将applications.tar.gz解压在/tmp,生成/tmp/applications及/tmp/lib目录。
将/tmp/lib拷贝至adminserver、node_A、node_B对应的目录下面。
将/tmp/applications/目录下所有文件中copy至adminserver对应目录下的applications目录中。
5.2. 配置环境变量
lib目录下面存放的是基础类库文件,在BSS系统运行时需要调用到,因此需要添加至weblogic classpath变量中。
修改adminserver下的startWebLogic.sh
$vi startWebLogic.sh
添加如下语句:
LIB_PATH="/data/test/bsstest/lib"
CLASSPATHSEP=:
CLASSPATH=${LIB_PATH}/aciiToString.jar${CLASSPATHSEP}${LIB_PATH}/aiobs_interface.jar${CLASSPATHSEP}${LIB_PATH}/classes12.jar${CLASSPATHSEP}${LIB_PATH}/cnc_bus.jar${CLASSPATHSEP}${LIB_PATH}/cncEx.jar${CLASSPATHSEP}${LIB_PATH}/cnc.jar${CLASSPATHSEP}${LIB_PATH}/cncweb.jar${CLASSPATHSEP}${LIB_PATH}/CommHandle.jar${CLASSPATHSEP}${LIB_PATH}/common.jar${CLASSPATHSEP}${LIB_PATH}/commons-beanutils-bean-collections.jar${CLASSPATHSEP}${LIB_PATH}/commons-beanutils-core.jar${CLASSPATHSEP}${LIB_PATH}/commons-beanutils.jar${CLASSPATHSEP}${LIB_PATH}/commons-lang-2.0.jar${CLASSPATHSEP}${LIB_PATH}/commons-logging-api.jar${CLASSPATHSEP}${LIB_PATH}/commons-logging.jar${CLASSPATHSEP}${LIB_PATH}/crypt.jar${CLASSPATHSEP}${LIB_PATH}/log4j.jar${CLASSPATHSEP}${LIB_PATH}/nls_charset12.jar${CLASSPATHSEP}${LIB_PATH}/ojdbc14.jar${CLASSPATHSEP}${LIB_PATH}/poi-2_5_1.jar
用相同方法修改node_A、node_B的startManagedWebLogic.sh中的classpath。
5.3. 服务器启停
启动管理服务器:
$nohup /data/test/bsstest/startWebLogic.sh >log &
停止管理服务器:
$/data/test/bsstest/stopWeblogic.sh或kill掉相应进程。
启动被管服务器:
$nohup /data/test/node_A/startManagedWebLogic.sh node_A http://127.0.0.1:7001 >log &
$nohup /data/test/node_B/startManagedWebLogic.sh node_B http://127.0.0.1:7001 >log &
停止被管服务器:
将node_A、node_B中的stopWebLogic.sh中的SERVER_NAME分别设为node_A,node_B
直接运行stopWebLogic.sh或kill掉相应进程即停止。
查看进程:
$ps –ef|grep java
若启动过程无任何报错,直到log提示<Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>则启动成功。
5.4. 发布应用程序
启动adminserver,进入控制台http://127.0.0.1:7001/console。
5.4.1 发布EJB:
在树型目录中,进入bsstest>Deployment>EJB Modules> Deploy a new EJB Module... ,选择applications目录下的jar文件,然后点击Target Module
如上图示将jar文件target至cluster上,点击Continue
选择将EJB模块发布至集群中每一台服务器上,然后点击Deploy,
发布成功后,状态如上图示。
按照相同方法发布其他EJB模块。
5.4.2 发布WEB应用程序模块
在树型目录中,进入bsstest>Deployment>Web Application Modules>Deploy a new Web Application Module…
选择DefaultWebApp,点击Target Module
将应用程序target至cluster上的所有服务器,点击Depoly,发布成功后如下图所示: