BEA Logo BEA WebLogic Server Release 1.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

Installing the Apache-WebLogic Server Plug-in

 

Installing the library

Configuring the httpd.conf file

Proxy by URL

Proxy by MIME file type

Parameters for the Apache-to-Weblogic Bridge

Sample httpd.conf file

Sample weblogic.conf files

Deploying the WebLogic-to-Apache Bridge

Overview

This document describes how to install and configure the Apache-WebLogic Sever plug-in. The plug-in allows a smooth integration of WebLogic Server's HTTP functionality into the Apache Server. Using the Apache-WebLogic Sever plug-in enhances an existing Apache installation by providing a way to access WebLogic Server's servlet engine transparently.

The plug-in is intended for use in an environment where an Apache Server serves static pages, and another part of the document tree (dynamic pages best generated by HTTP Servlets) is delegated to a WebLogic Server operating in a different process, possibly on a different host. To the end user - the browser - the HTTP requests delegated to WebLogic Server still appear to be coming from the same source; WebLogic Server on the back-end is invisible. The HTTP-tunneling facility of the WebLogic Server client-server protocol may also operate through the plug-in, providing access to all WebLogic Server services, not only HTTP servlets.

The Apache-WebLogic Sever plug-in operates as an Apache module within an Apache Server. An Apache module is loaded by an Apache Server at startup, and then certain HTTP requests are delegated to it. Apache modules are similar to HTTP (Java) servlets, except that an Apache module is in code native to the platform. The Apache plug-in has been tested and is intended for use with Apache Server 1.3.9.

Installing the library

The Apache plug-in is distributed as a shared object (.so) for use on Solaris platforms. These files are located in the weblogic/lib directory.

The .so for Solaris is shipped in the weblogic/lib/solaris directory as the file

mod_wl.so. 

The Apache plug-in is installed as an Apache DSO (Dynamic Shared Object). DSO support in Apache is based on a module named mod_so.c which needs to be enabled before mod_wl.so is loaded. If you installed Apache with the supplied script for Solaris, or with the Windows NT installshield, mod_so.c should be enabled. To be certain that mod_so.c is enabled, run:

APACHE_HOME/conf/httpd -l

This command lists all of the enabled modules, if mod_so.c is listed, follow the 6 numbered steps at the end of this section. If mod_so.c is not listed, follow the instructions included with the distribution of Apache to manually configure Apache with the following parameters:

/configure --prefix=<destination directory>

  --enable-module=so

  --enable-rule=SHARED_CORE  

Continue following the Apache installation instructions to make and install the product.

After Apache installation is complete with the mod_so.c enabled. The Apache plug-in is installed with a support program named apxs (APache eXtenSion) that builds DSO based modules outside of the Apache source tree, and will add the AddModule mod_so.c line to the httpd.conf file. To install the Apache-WebLogic Sever plug-in follow these 6 steps:

  1. cd to weblogic/lib directory and activate the weblogic_module by issuing this command:

    APACHE_HOME/bin/apxs -i -a -n weblogic mod_wl.so

  2. This copies the mod_wl.so file to the APACHE_HOME/libexec directory. It also adds AddModule and LoadModule lines for weblogic_module in Apache's file and activates the module. Verify that the following lines were added to your APACHE_HOME/conf/httpd.conf file:

    LoadModule weblogic_module

    AddModule mod_weblogic.c

  3. Verify the syntax of the APACHE_HOME/conf/httpd.conf file with the following command:

    APACHE_HOME/bin/apachect1 start

  4. Configure Apache's httpd.conf configuration file as described in the next section.

  5. Start Weblogic Server.

  6. Start Apache.

Configuring the httpd.conf file

After you install the libraries, you will need to modify the httpd.conf file to configure the Apache plug-in. Modifying the httpd.conf file informs the Apache web server that it should load the native library for the plug-in as an Apache module, and also describes exactly which requests should be handled by the module. The correct file for Apache will be located in APACHE_HOME/conf/httpd.conf (where APACHE_HOME is the root directory of Apache installation).

To set up the WebLogic Apache plug-in on Apache, you will need the following information in the httpd.conf file:

Proxy by URL

If you choose to proxy by URL, the location block and SetHandler will be used. SetHandler specifies the handler for the Weblogic module as shown below.

<Location URL> 
SetHandler weblogic-handler
</Location>

For example:

<Location /weblogic>
SetHandler weblogic-handler
</Location>

<Location /servletimages>
SetHandler weblogic-handler
</Location>

In this manner, URLs directed to Apache at the specified location will be passed to the WebLogic Server for parsing. Because the PathTrim has been set to strip /weblogic from the URL, the URL forwarded to the WebLogic Server will be:

http://myenterprise.server.com:7001

Note, the Apache-WebLogic Server plug-in can not be configured to proxy requests to multiple WebLogic Clusters. Requests that match any of the URLs specified in the location blocks will be forwarded to the same cluster.

Proxy by MIME file type

To proxy by MIME file extension type, you must place an identifier of the selected MIME type to the mime.types file in your configuration directory. For example, the JSP MIME type can be selected as follows:

<Files *.jsp>
SetHandler weblogic-handler
</Files>

Parameters for the Apache-Weblogic Server Plug-in

The Weblogic Module for Apache recognizes the following parameters. To modify the properties of your Apache-WebLogic Sever plug-in, these parameters can be placed in the IfModule or a Weblogic.conf file that is included in the IfModule.

<IfModule mod_weblogic.c>
# Config file for Weblogic which defines the parameters
Include conf/weblogic.conf
</IfModule>

or

<IfModule mod_weblogic.c>
# define your parameters here.
</IfModule>

Please note that each parameter should go in a new line, and there should not be an `=' between the parameter and its value. For Example:

PARAM_1 value1
PARAM_2 value2
PARAM_3 value3

WebLogicHost domain name

Required (If you are using a WebLogic Cluster, use the WebLogicCluster parameter instead.). WebLogic Server host to which HTTP requests should be forwarded.

WebLogicPort port
Required (If you are using a WebLogic Cluster, use the WebLogicCluster parameter instead.). Port at which the WebLogic Server host is listening for WebLogic connection requests.

WebLogicCluster cluster list
Required (If you are using a WebLogic Cluster) List of WebLogic Servers that can be used in a cluster for load-balancing. The cluster list is a comma-delimited list of host:port entries. For example,

WebLogicCluster myweblogic.com:7001,
yourweblogic.com:6999,theirweblogic.com:6001

This parameter should be used instead of the WebLogicHost and WebLogicPort parameters. The WebLogic Server will look first for the WebLogicCluster parameter. If not found, it will look for and use WebLogicHost and WebLogicPort.
The Apache plug-in does simple round-robining between all available cluster members. The Apache plug-in will direct HTTP requests containing a cookie to the server in the cluster that originally created the cookie.

PathTrim string
String to be trimmed from the beginning of the original. Default is "weblogic".

PathPrepend string
String to be prepended to the beginning of the original URL, after PathTrim has been trimmed, and before the request is forwarded to WebLogic. Default is "".

ConnectTimeoutSecs seconds
Maximum interval (in seconds) that the module should attempt to connect to the WebLogic Server host. Defaults to 10 seconds, and should be greater than ConnectRetrySecs. If ConnectTimeoutSecs expires without a successful connection, even after the appropriate retries (see ConnectRetrySecs) an HTTP 503/Service Unavailable response is sent to the client.

ConnectRetrySecs seconds
Interval (in seconds) that the module should sleep between attempts to connect to the WebLogic Server host. Defaults to 2 seconds, and this number should always be less than ConnectTimeoutSecs. Before returning an HTTP 503/Service Unavailable Response to the client, the Apache plug-in will attempt to connect every ConnectRetrySecs before ConnectTimeoutSecs. If ConnectRetrySecs is set equal to ConnectTimeoutSecs, only one attempt to connect will be made.

StatPath boolean
If set to true, the Apache-WebLogic Sever plug-in will check the existence and readability permissions of the translated path ("Proxy-Path-Translated") of the request before forwarding the request to WebLogic Server.
Defaults to false. If the file doesn't exist, an HTTP 404/Not Found response will be returned to the client. If the file exists but is not world-readable, an HTTP 403/Forbidden response will be returned to the client. In either case, the default mechanism for Apache Server to handle these responses will fulfill the body of the response. This option is useful if both the WebLogic Server servlet engine and Apache Server have the same document root.

ErrorPage URL
You may create your own error page that will be displayed when Apache Server is unable to forward requests to WebLogic Server. Set the URL to the location of your error page.

Sample httpd.conf file

Below is an example httpd.conf file. You can use this example as a template that you can modify to suit your environment and server. Lines beginning with # are comments. Please note that Apache is not case sensitive, and that the LoadModule and AddModule lines will be automatically added by the apxs utility.

############################################

APACHE-HOME/conf/httpd.conf file

############################################

LoadModule weblogic_module         libexec/mod_wl.so

##### Weblogic specific declarations ########

<Location /weblogic>
SetHandler weblogic-handler
PathTrim weblogic
# or you can set PathTrim to /weblogic
ErrorPage http://myerrorpage1.mydomain.com
</Location>

<Location /servletimages>
SetHandler weblogic-handler
Pathtrim something
ErrorPage http://myerrorpage1.mydomain.com
</Location>

<Files *.jsp>
SetHandler weblogic-handler
</Files>

################## Parameters ####################

<IfModule mod/weblogic.c>
Include conf/weblogic.conf
</IfModule>

############# End of WebLogic specific declarations #######

AddModule mod_weblogic.c

Sample weblogic.conf files

Instead of defining Weblogic Parameters in the location block of your httpd.conf file, if you prefer, you can use a weblogic.conf file that is loaded by the IfModule in the httpd.conf file. Either of the following examples may be used as templates that you can modify to suit your environment and server. Lines beginning with `#' are comments.

Example using WebLogic Clusters

####################################################

APACHE>HOME/conf/httpd.conf file
### Example using WebLogic Clusters ####

####################################################

# These parameters are common for all URLs which are 
# directed to the current module.

WebLogicCluster  w1s1.com:7001,w1s2.com:7001,w1s3.com:7001

# note that the default PathTrim is also "weblogic"

PathTrim weblogic
ErrorPage http://myerrorpage.mydomain.com

# Note: If you want to override these parameters for each URL, 
# you can set them again in the <Location> or <Files> blocks

####################################################

Example without WebLogic Clusters

####################################################

APACHE>HOME/conf/httpd.conf file
### Example without WebLogic Clusters ####

####################################################

# These parameters are common for all URLs 
# which are directed to the current module.

WebLogicHost myweblogic.server.com
WebLogicPort 7001
PathTrim weblogic

# Note: If you want to override these parameters for each URL, 
# you can set them again in the <Location> or <Files> blocks

####################################################

Deploying the Apache-WebLogic Server plug-in

Once you have installed and configured the Apache-WebLogic Sever plug-in, follow these steps for deployment and testing:

  1. Start Weblogic Server.

  2. If your Apache Server is already running, you must restart it order for the new settings to effect.

  3. To test the Apache plug-in, open a browser and set the URL to the Apache Server + "/weblogic/", which should bring up the default WebLogic HTTP servlet, as shown in this example:

    http://myenterprise.server.com/weblogic/