Using the WebLogic classes for server-side Java
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:
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."
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.
For the Java Server, you must add each class file you will run as server-side Java to the Jeeves admin/servlet.properties 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 servlet.properties file:
HelloWorld.code=examples.htmlkona.HelloWorld HelloUniverse.code=examples.htmlkona.HelloUniverse ...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 servlet.properties file, you request a class following this pattern:
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,
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:
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.