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.
Here are the Apache and JServ versions that I started with:
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):
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 you can see how to unpack and setup the "classic" flavor:
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.