Powered by SmartDoc
ENGLISHJAPANESE

On Linux

[ToDO] We show how more stable system can be built on Linux. The content present in this guide mostly concerns the programming environment where programmers can rapidly develop prototypes. This appendix should show how to develop prototypes into more stable, reliable systems, using only open source software.

Building your web server on Linux

First of all, happily, you do not need to build a Unix-like environment as you have to do on Windows9X because Linux is already a UNIX. Installation of Java, prolog, and JPL, is not as complicated as you have to manage on Windows.

Java Development Kit

Sun provides us with JDK-1.2.2 for Solaris, which works fine. You can alternatively try JDK-1.3 distributed by IBM.(6) I found no problem in installing and using JDK-1.2.2 provided by Sun. You should, however, not forget to include lib/tools.jar in your classpath.

Installing SWI-prolog

There is not any problem in installing SWI-prolog on Linux. Do not forget to copy (or move) runtime/libpl.a to /usr/lib.

You can create a SWI_prolog capable of handling multi-threads. The version does, however, not work with JPL, a Java Prolog interface. So do not be bothered with it.

Installing JPL

You follow the same instruction as given in the content of this guide. You should, however, use jpl/src/Makefile to compile libjpl.so. Copy libjpl.so which you have created under jpl/lib to some directory, e.g., /usr/lib, and add it to the variable, LD_LOAD_PATH, so that the shared library object can be evoked on the spot.

Web servers running Servlet

You only need to install Tomcat to run servlets, but you may want to add it to your Apache Web Server. The instruction is given in the reference manual of Tomcat under jakarta-tomcat/doc/uguide/tomcat_ug.html. In short, you first run Tomcat and terminate it, then. There must be a file, jakarta-tomcat/conf/tomcat-apache.conf. You should then edit httpd.conf of Apache to include the file by adding a few lines.

Some other minor points to note are:

  1. Some other program may occupy the port 8080. If it is the case, you have to either remove the service occupying 8080 or force Tomcat to use some other port. Edit /etc/services if you choose the former.
  2. You have to run tomcat as root (if you have installed it on somewhere like /usr/local.
  3. Some Linux distributions come with an Apache server pre-installed. Replace the latest apache for the pre-installed one. Do not forget in that case to force Linux to read the httpd.conf you have installed on it. The setting can be changed using linuxconf. (Again you have to be root.)
  4. If you choose to install Tomcat as an add-on to apache, you have to enable your apache server to dynamically load objects. (The apache server must be DSO capable). Follow the instruction given in Apache install guide to add DSO module to your apache server. Do not foget to compile mod_so by yourself. You go down to src, edit Configuration to uncomment 'AddModule mod_so', do 'make', and go up to apache HOME to 'make install'.
  5. You need mod_jserv.so to enable your apache server to invoke Tomcat on demand. You can find a pre-compiled shared libary object in a page to download Tomcata binaries. Follow the link, linux. Download and copy it under apache/libexec.
  6. If you run Tomcat from Apache, you have to first run Tomcat, and then Apache because Apache reads in jakarta-tomcat/conf/tomcat-apache.conf when it starts up.
  7. The content of web.xml is not read by Apache when it deligates a job to Tomcat. Your servlets can, therefore, not be evoked using aliases as specified in web.xml. You may evoke Servlets from Apache if you include the items of information into httpd.conf, but it may not be worth trying. We had better wait for future releases of Tomcat as it is likely to be integrated into Apache in the long run and we expect that servlets will be easier to use, then.

Creating Web applications

The shell script did not work on my environment. If you encounter the same problem, try the following:

java -classpath $CLASSPATH org.apache.tools.ant.Main -Dtomcat.home=$TOMCAT_HOME
You have to include ant.jar, xml.jar, jasper.jar, servlet.jar, and webserver.jar to your classpath, though. (They are all found under $TOMCAT_HOME/lib)

  1. I have installed it on 17th July, 2000, and found it work okay. It looks faster, too, but I had to recompile the samples presented in this guide.

Extending your web server

There is nothing special to Linux. You can just do the same thing as you are on Windows.