环境准备软件平台:Windows 2000 professional + SP4、WebLogic Server 8.1 SP2机器准备:  机器名
 IP地址
 用途
 
ericwang
 192.168.80.109
 WebLogic服务器
 
test
 192.168.80.110
 用于测试的客户端
 WebLogic Domain配置:名称
 值
 
BEA Home
 C:ea
 
Domain类型
 Basic WebLogic Server Domain
 
Domain Location
 C:eauser_projectsdomainsmydomain
 
Server Name
 myserver
 
Server 监听地址
 192.168.80.109
 
Server 监听端口
 7001
 
WebLogic Configuration Startup Mode
 Development mode
 
myserver的用户名
 weblogic
 
myserver的口令
 weblogic
 hosts文件:在test机器上的C:WINNTsystem32driversetc目录下面,找到hosts文件,加入以下两行:192.168.80.109  news.synnex-china.com192.168.80.109  tech.synnex-china.com配置虚拟主机方法一(通过控制台)在console的左边导航栏,中选择mydomain ->Services-> VirtualHosts,然后在右面点击Configure a new Virtual Host...,在Configuration的General选项卡下面,填写:Name: newsVirtual Host Names: news.synnex-china.com然后点击“apply”,然后到Target and Deploy 选项卡,选中myserver,点击“apply”,这样名称为news的虚拟主机就搭建成功了。方法二(通过weblogic.Admin工具)1、创建一个名称为news的虚拟主机,java weblogic.Admin -url t3://192.168.80.109:7001 -username weblogic -password weblogic CREATE -name news -type VirtualHost2、设置虚拟主机news的VirtualHostNamesjava weblogic.Admin -url t3://192.168.80.109:7001 -username weblogic -password weblogic SET -mbean "mydomain:Name=news,Type=VirtualHost" -property VirtualHostNames news.synnex-china.com 3、把虚拟主机news 部属到weblogic上java weblogic.Admin -url t3://192.168.80.109:7001 -username weblogic -password weblogic SET -mbean "mydomain:Name=news,Type=VirtualHost" -property Targets "mydomain:Name=myserver,Type=Server"可以任取上面的方法之一,可以创建name为tech的虚拟主机,其Virtual Host Names为tech.synnex-china.com ,并将虚拟主机tech部署到WebLogic Server上。配置完成后,重新启动WebLogic Server。配置Server的默认Web应用1、  参考8.1的edocs(http://edocs.bea.com/wls/docs81/index.html ),在webapps目录下面的weblogic.xml中,加入:  <context-root>/</context-root>2、  将webapps打包成webapps.war文件,然后部属到weblogic server上,部署成功后,console中显示如下: 图1 部署webapps.war文件成功后的欢迎画面3、在test机器上,通过浏览器访问,http://192.168.80.109:7001/ ,出现如下画面,说明配置Server的默认Web应用成功。 图2 WebLogic Server默认Web应用画面配置虚拟主机的Web应用1、将news打包成news.war文件,然后部属到weblogic server上面的news虚拟主机上,成功后,显示如下: 图3 部署news.war文件成功后的欢迎画面2、在test机器上,通过浏览器访问,http://news.synnex-china.com:7001/news ,出现如下画面,说明配置的虚拟主机Web应用成功。 图4 虚拟主机news的Web应用画面