BEA Logo BEA WebLogic Server Release 5.0

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

Using the WebLogic classes for server-side Java

Installing the WebLogic classes on a JavaSoft Java Server or a WebLogic Server
Configuring your Java Server to serve servlets
Configuring your WebLogic Server to serve servlets
Using the WebLogic classes with Netscape Fast Track or Enterprise


There are currently several types of servers that are Java-enabled; that is, the server can interpret a Java class file. This is known as server-side Java. It is not the same as using Java to write an applet that is run in a browser on the client side. Server-side Java is most commonly used as a tidy Java replacement for CGI.

Java-enabled servers currently available include:

  • The WebLogic Server, using WebLogic Remote. Although it is not designed specifically to serve HTML pages, you can use it as your first-line HTTP server to respond to server-side Java requests, and set a proxy to another HTTP server to respond to requests to which the WebLogic Server cannot respond. For more information, check the product description and the developers guide Using WebLogic Remote.
  • JavaSoft's Java Web Server (formerly Jeeves). For more information on the Java Server, check the Java Server pages at JavaSoft.
  • Netscape's Enterprise and Fast Track servers. For more information on the Netscape servers, check the Netscape website.
  • Oracle's WebServer. For more information on Oracle's WebServer, check their website.

You do not need an HTTP server to use WebLogic products, unless of course you want to use WebLogic products for server-side Java or for applet programming. Server-side Java implies the use of a Java-enabled server to interpret your class files. Those class files are installed on the HTTP host.

This document covers how to install the WebLogic class files on the server, and gives general information about details that should be added to the server configuration. This document does not cover installation for any of these servers.

For another viewpoint of using server-side Java, check out Jason Hunter's article in the March 1997 issue of JavaWorld, entitled "How to get started with server-side Java."

Top of the page

Installing the WebLogic classes on a JavaSoft Java Server or a WebLogic Server

You can install the WebLogic classes anywhere on the host machine, in the proper hierarchy dictated by the full package names of the classes. The WebLogic Server looks for classes in the CLASSPATH of its host.

Likewise, JavaSoft's Java Server searches for classes in the CLASSPATH of the shell where the server is started. For example, if your WebLogic classes are located in the directory c:\dev\weblogic\classes on a WindowsNT machine, you would start a Java Server as follows:

  $ C:\> set CLASSPATH=c:\dev\weblogic\classes;%CLASSPATH%
  $ C:\> cd \jeeves\JeevesA2
  $ C:\jeeves\JeevesA2> start bin\httpd.exe

(Using the "start" command in NT spawns a new shell in which it runs the Java Server. It is the same as adding an ampersand after the command in UNIX.)

Note that the shell from which you start the WebLogic Server must have a correctly set Java CLASSPATH.

Top of the page

Configuring your Java Server to serve servlets

For the Java Server, you must add each class file you will run as server-side Java to the Jeeves admin/ file (current with the JeevesA2 release). In this file, you alias each class file to its full package name. The first time a class is requested, it is loaded into the server. If you recompile the file, you must restart the server for the changes to take effect.

For example, to be able to run the tutorial class files shipped with the WebLogic distribution on a Java Web Server, you must include the following in your Java Server file:

and so forth. Note that you should not introduce any extra whitespaces around the equals ("=") signs.

After aliasing each class' full package name to the file, you request a class following this pattern:

  • The hostname and port
  • The invocation for server-side Java, "servlet"
  • The alias you entered in the file
For example, suppose you have aliased the class tutorial.jeeves.example1 to example1 in the file. To request this class from a Java Server running on port 8888 on the host, you would enter this URL in your browser:

Top of the page

Configuring your WebLogic Server to serve servlets

A full explanation of how to configure servlets in the WebLogic Server can be found in the Administrators Guide, "Setting WebLogic properties" under the section Registering user-written servlets.

Top of the page

Using the WebLogic classes with Netscape Fast Track or Enterprise

If you are installing a Netscape server for the first time, complete the installation process before adding WebLogic products. For help on installing, check the Administrator's Guide page at Netscape for detailed installation and maintenance instructions for your server and platform.

Your Netscape server may not require any configuration. The configuration instructions provided here are known to be required for Netscape Fast Track and Netscape Enterprise servers, both Java-enabled servers.

If you are using a WebLogic product for server-side Java, such as WebLogic Express or htmlKona, then you may need to configure your Netscape server to accommodate that usage. For instance, the Netscape examples in the tutorial directory of the distribution use server-side Java.

To configure your Netscape Enterprise or Fast Track server to use the WebLogic classes, you must edit the server object configuration file, called obj.conf in the httpd-[name]/config directory, that defines access to the server and manages the files and directories the server can send to its clients. For more information on the obj.conf file, check the documentation at Netscape.

Before you can edit the configuration file, you must have permission to read and write to the configuration files, which will probably require root access.

To use server-side Java with a Netscape Java-enabled server, you should:

  1. Install the entire contents of the weblogic/classes directory on the HTTP host.

  2. Configure the HTTP server to add the classes directory to your CLASSPATH. Follow these steps:
    • Open the obj.conf file (in the httpd-[name]/config directory in a text editor.
    • Insert or append the full path of the weblogic/classes directory on the server to the classpath variable, as in this example (shown here for a Solaris installation):
    • Save your changes.
    • In the Netscape Server Manager, click on "Apply" in the upper right hand corner to apply your changes.

  1. From the Programs menu, select Java to turn on the Java interpreter.

  2. Place your Java servlet in the directory referenced there.

  3. Restart the server.

  4. Invoke your servlet with a URL, using this pattern:

You will need to restart the server before any of your Java classes will run. Java classes are loaded into the server at start time, via an init function in the obj.conf file. You have to stop/start the server to load new or re-compiled server-side Java classes.

If you are using Enterprise Server, you should check out WebLogic's NSAPI plug-in that lets you proxy WebLogic-related requests to WebLogic from your Enterprise Server.


Copyright © 2000 BEA Systems, Inc. All rights reserved.
Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.
Last updated 01/13/1999