) WebLogic Server 8.1 virtual host configuration best practices

Source: Internet
Author: User

Author: Wang Chao (dev2dev Forum ID: chaowang)

This article briefly introduces howConfigure the VM as follows:

Environment preparation

Configure a VM

Configure the default web application of the server

Configure Web applications for the VM

Configure the default web application of the VM

Environment preparation

Software Platform: Windows 2000 Professional + SP4, WebLogic
Server 8.1 SP2

Machine preparation:

Machine name

IP address

Purpose

Ericwang

192.168.80.109

WebLogic Server

Test

192.168.80.110

Client used for testing

WebLogic Domain Configuration:

Name

Value

Bea home

C: Ea

Domain type

Basic WebLogic Server domain

Domain location

C: eauser_projectsdomainsmydomain

Server Name

Myserver

Server listening address

192.168.80.109

Server listening port

7001

WebLogic configuration Startup Mode

Development Mode

Username of myserver

WebLogic

Myserver Password

WebLogic

Hosts file:

In the C: winntsystem32driversetc directory on the test machine, locate the hosts file and add the following two lines:

192.168.80.109 news.synnex-china.com

192.168.80.109 tech.synnex-china.com

Configure a VM

Method 1 (via console)

In the left-side navigation pane of the console, select mydomain.
-> Services->
Virtualhosts, and then click Configure a new virtual host... on the right. Under the General tab of configuration, enter:

Name: News

Virtual host names: news.synnex-china.com

Click "Apply", go to the target and deploy tab, select myserver, and click "Apply". In this way, the virtual host named "news" is successfully created.

Method 2 (using weblogic. Admin)

1. Create a virtual host named "news,

Java weblogic. Admin-URL T3: // 192.168.80.109: 7001
-Username Weblogic-Password WebLogic create-name news-type
Virtualhost

2. Set virtualhostnames for the VM news

Java 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. Add the news department of the VM to 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"

You can take any of the above methods, you can create a virtual host named Tech, its virtual host names for the tech.synnex-china.com
And deploy the VM tech on the WebLogic Server.

After the configuration is complete, restart the WebLogic Server.

Configure ServerDefault webApplication

1. Refer to 8.1 eDocs (http://edocs.bea.com/wls/docs81/index.html
In weblogic. xml under the webapps directory, add:

<Context-root>/</context-root>

2. Package webapps into the webapps. War file, and post them to the WebLogic Server. After the deployment is successful, the console displays the following:

Figure 1 Welcome picture after the webapps. War file is successfully deployed

3. access through a browser on the test server through http: // 192.168.80.109: 7001. The following screen is displayed, indicating that the default web application of the server is successfully configured.

Figure 2 WebLogic Server default web application Screen

Configure the WebApplication

1. Package news into a news. War file and post it to the news virtual host on the WebLogic Server. After successful, the following information is displayed:

Figure 3 Welcome picture after the news. War file is successfully deployed

2, on the test machine, access through a browser, http://news.synnex-china.com: 7001/news
The following figure shows that the Web application of the configured VM is successful.

Figure 4 Web application screen of VM news

Configure the default webApplication

1. Refer to the eDocs (http://edocs.bea.com/wls/docs81/config_xml/VirtualHost.html#DefaultWebApp) of wls8.1 to add the WEB-INF/weblogic. xml below the tech directory:

<Context-root>/</context-root>

Then, deploy the service on the tech VM on the WebLogic Server. The result is as follows:

Figure 5 failure of deploying default web applications on the virtual host TECH 1

Figure 6 failure of deploying the default web application on the virtual host TECH 2

This indicates that only one conext-root for/can exist in a WebLogic Server/
. At this time, if you delete the webapps Web applications deployed on the WebLogic Server, the default web applications deployed on the virtual host tech can be successfully deployed. However, this is not my intention. In this way, only one VM can have a default web application among multiple VM instances.

In this case, how do I configure the default web applications for multiple virtual hosts?

After carefully analyzing the composition of the config. xml file elements, I decided to set the default web application for the web host of wls8.1 in a way compatible with wls7.x.

First remove the contxt-root entry for the WEB-INF/weblogic. xml under the tech directory, then redeploy the tech application, and finally close WebLogic
Server. Manually modify the config. xml file as follows:

<Virtualhost name = "tech" targets = "myserver"Defaultwebapp = "tech"
Virtualhostnames = "tech.synnex-china.com"/>

After saving config. XML, start WebLogic Server.

2, on the test machine, access through the browser, http://tech.synnex-china.com: 7001/
The following figure shows that the default web application configuration of the VM is successful.

Figure 7 default web application screen of VM tech

Postscript

1. In a WebLogic
Server can only have one web application whose context is.

2. In wls8.1, the weblogic. Admin tool cannot be used to set the default web application of the VM. For example:

Java weblogic. Admin-URL
T3: // 192.168.80.109: 7001-username Weblogic-Password WebLogic get-mbean
"Mydomain: Name = synnex-China, type = virtualhost"-property defaultwebapp
Synnex

It can be seen that the defawebwebapp option has been gradually eliminated by Bea.

3. You can use the weblogic. Admin Tool to view the properties of the virtual host whose name is news.

Java weblogic. Admin-adminurl: 192.168.80.109: 7001-Username
Weblogic-Password WebLogic query-pattern *: Name = News ,*

Click here to download the relevant code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.