Apache 1.3.9 with JServ 1.1 for MPE/iX

  1. Introduction
  2. Source Download
  3. How to Build
  4. Binary Download
  5. How to Setup
  6. Tips and Tricks
  7. References

Introduction

In February 1999, I played with a trial version of Sun's Java Web Server on MPE/iX. First of all, I was curious to verify Java's promise of "write once, deploy anywhere" and whether it would work on the HP 3000 virtual machine. It did. Moreover, I also wanted to learn a little bit more about the Java Servlet technology. The Servlet API provides web server extensions that allow implementing dynamic web pages or full-fledged web applications using server-side Java, without having to struggle with various shortcomings of the traditional CGI based approach.

The Java Servlet API basically implements dynamic web pages by subroutine calls -oops- method invocations for objects that are supplied to extend the web server's core functionality. As such, the API is mainly designed for Java based web servers. However, there is also an Open Source project called Apache JServ, that integrates Java Servlet capabilities with the popular Apache web server.

With Apache already being available for the HP 3000, I was curious whether Apache JServ could also be ported to MPE/iX with reasonable effort. It could. With only marginal adjustments. The architecture of Apache JServ is somewhat similar to FastCGI, however it is geared towards the Servlet API. There is a standalone servlet engine, implemented in pure Java (and thus a no-brainer from the porting perspective), and a module called mod_jserv, implemented in C (but also very portable thanks to GNU autoconf). The module enables the Apache httpd program to communicate to the JServ servlet engine for passing requests and returning results.

Also see my little write-up regarding "Server side Java with Apache/iX" on Jazz for a few Java Servlet source code examples.

The current release of Apache JServ for MPE/iX is based on the Apache 1.3.9 and JServ 1.1 versions. It comes in two flavors, the "classic" one, where mod_jserv is compiled into the httpd program to create a customized Apache version, and the "new" one, which has been built to be loaded by the fairly recent DSO feature (dynamic shared objects) of Apache, where mod_jserv is loaded from a shared library (an NMXL in MPE terms). The latter approach can be quite handy, for example, when you want to add Java Servlet capabilities to HP WebWise, the Apache/iX version that provides security features like SSL encryption.

Please notice that I did the Apache JServ porting for my own pleasure (and the benefit of the HP 3000 community). I'm sharing all this material as "totally unsupported" and with a big "use at your own risk" disclaimer. So please don't blame me if something does not work as expected or does not even work at all. It worked nicely for what I've tried and used so far, but that's not a guarantee for anything. Keep in mind that I am only tasting this software, not testing it.

Source Download

This step is optional. If you don't want to spend time on building Apache JServ from the C and Java source code yourself, you may skip ahead to the Binary Download section, which provides precompiled binaries that can be run on MPE/iX "out of the box" (as long as you have the Java Virtual Machine installed).

Here are the Apache and JServ versions that I started with:

Here are the MPE specific additions/adjustments: Notice that you also need to download the Java Servlet Developer Kit 2.0 from Sun. The build needs the jsdk.jar file! You need to download all of the above. The "MPE delta package" will patch and amend the original sources.

How to Build

As mentioned above, this step is optional. Skip to the Binary Download section, if desired.

There are two different flavors of Apache JServ for MPE/iX. You have to choose, which one to build. The "classic" flavor compiles mod_jserv into the Apache httpd program, the "new" flavor compiles in such a way, that mod_jserv can be loaded by httpd using the Apache DSO functionality. The latter build will include the Apache/iX server enabled for DSO (with mod_so compiled in), but you could also decide to just pick up the JServ related parts and integrate them with another Apache/iX executable (as long as you take are to override hardcoded defaults for file and directory names, for example).

You need GNU core and GNU gcc compiler, as well as a Java Developer Kit for MPE/iX installed on the build system. You can find those packages on Jazz, for example. For building the DSO flavor, you also need GNU perl on your system (only for the build, not during the deployment phase). I used JDK 1.1.7 and built both flavors on MPE/iX 5.5 with PowerPatch 7. However, notice that only
the "classic" flavour can be deployed on MPE/iX 5.5; the DSO flavor seems to require MPE/iX 6.0 for some reason.

Another thing that's probably worth mentioning: I have used my version of GNU autoconf 2.13 for regenerating the configure scripts with MPE specific extensions/adjustments. If your system only has the older 2.12.x version that comes with some versions of the GNU core package from Jazz, then you'd probably want to avoid executing autoconf to not break the configure script that comes with the above "MPE delta package" download. The MPE build job uses a special PATH setting to "hide" the autoconf in /usr/local/bin.

For a successful build, you might need to patch your /etc/c89.ccg or /etc/ld.ccg file(s):

Here you can see how to unpack and build the "classic" flavour: Here you can see how to unpack and build the DSO flavour: By the way, I have used the GNU make and gcc compiler, because it's available for free and typically used by many of the Open Source developer communities. You might also be successful with the HP C/iX compiler (c89). I haven't used that for porting freeware since my Samba/iX days (except when I want the more convenient access to MPE/iX Intrinsics via #pragma intrinsic, for example).

Binary Download

This step is optional, if you performed the build from C and Java source code. Skip ahead to the How to Setup section and ignore the unpacking of tar archive files there. If you built the binaries yourself, you are now only interested in the tips regarding the config files that have to be put in place and customized as appropriate.

There are two different flavors of Apache JServ for MPE/iX. You have to choose, which one to install. The "classic" flavor contains
mod_jserv compiled into the Apache httpd program, the "new" flavor was compiled in such a way, that mod_jserv can be loaded by httpd using the Apache DSO functionality. The latter flavor does include the Apache/iX web server enabled for DSO (with mod_so compiled in), but you could also decide to just pick up the JServ related parts and integrate them with another Apache/iX web server executable (as long as you take are to override hardcoded defaults for file and directory names, for example). Please notice that the DSO flavour only works on MPE/iX 6.0 and later releases.

Here are the precompiled binaries for the "classic" flavor:

Here are the precompiled binaries for the DSO flavor: Notice that you also need to download the Java Servlet Developer Kit 2.0 from Sun. The servlet engine needs the jsdk.jar file! Of course, you also need to have a Java Virtual Machine for MPE/iX installed on your system. When using JDK 1.1.7 from Jazz,
you should make sure that java -fullversion shows A.17.03 on your machine. You can find a related "patch" download on the Jazz, if you only have A.17.02 installed. More recent Java/iX versions like 1.2 or 1.2.2 should also work fine.

How to Setup

In the following session snippets you will see how to unpack precompiled binaries, customize a number of sample configuration files and start the server jobs for Apache as well as the JServ engine. Please ignore the tar file unpacking steps, if you have built Apache JServ from C and Java source code, as the appropriate files will already be in place (however, you still have to customize the config files). The session snippets also give hints which URLs to use for testing the web server and servlet engine, how to check versions, where to find logfiles and how to stop the servers gracefully.

Here you can see how to unpack and setup the "classic" flavor:

Here you can see how to unpack and setup the DSO flavor: Detailed documentation for Apache can be found in the htdocs/manual subdirectory. Detailed documentation for ApacheJServ resides in the docs directory. It is probably a good idea to also make this "visible" in the htdocs tree by adding a symbolic link. This way you can view both documentation sets from your favourite web browser.

Tips and Tricks

After running the supplied example CGI script and Java Servlets successfully, you will probably want to start adding your own code. You might find my write-up "Simple CGI Example in COBOL/iX" on Jazz useful, as it contains example code as well as a number of tips or warnings regarding potential pitfalls. The write-up "Server side Java with Apache/iX" on Jazz contains a few examples for Java Servlets, you might find it helpful to compare the jCobCGI servlet implementation to the COBOL example side-by-side to get an idea about the differences between CGI and Java Servlets. The Music Servlet gives an example how to use JDBC to make Image/SQL or Allbase/SQL data available in web pages created by Java Servlets.

Additional tips and examples for Java (programs, applets, servlets) can be found at my web page at the EditCorp site.

Using Samba/iX can be very handy for maintaining config files and documents on the MPE/iX based web server. By mounting selected directories of the HP 3000 files system as a "network drive" on a PC or Linux workstation, you can directly access the files residing on the 3000 without having to struggle with file transfers. This can be very helpful when working with HTML editors, for example. You can also work on Java Servlet source code using PC or Linux tools. One of the positive side-effects of using remote file access via Samba, is the fact that files created on the 3000 side will always be bytestream format. This is important as MPE specific formats like fixed or variable record length ASCII files should be avoided (as they tend to cause problems for Java or Apache access).

Due to the cross-platform nature of Java, you are not required to develop and compile Java Servlets on the 3000 itself. It is possible (and probably useful) to use a PC (or even laptop) to develop "offline" (i.e. using a local servletrunner for testing) and later deploy the compiled class or jar files on the 3000. I have even used this "detached" development with servlets that use JDBC for database access; a small MS Access database supplies sample data via the JdbcOdbc bridge driver for prototyping, and for deployment the driver is changed to HP JDBC with access to live Image/SQL data. Even if not developing in "detached" mode, you can still use the PC tools and resources by keeping working copies of source code on the PC and redirecting the javac compiler output to a Samba share with the -d option.

While we are on the subject of developing across different platforms... Of course, it is also possible to use different scenarios for the Apache JServ deployment. As mod_jserv talks to the JServ engine via TCP/IP, the Apache server can be run on MPE/iX as well as another platform (that supports Apache). This can be helpful for load balancing or firewalling reasons, for example. Even the servlet engine can be run on MPE/iX or another platform (that supports Java). Java Servlets using JDBC to access Image/SQL or Allbase databases can deal with these variations easily. From the Apache JServ documenation you will also notice that you can have more than one instance of the Apache web server and/or more than one instance of the JServ engine, if you are keen on distributing workload.

References

Lars Appel, March 2000