Setting Tomcat3.1 with Apache > FAQ and Trouble Shooting
Previous Page Contents Next Page
OOP-Reserch home page

Mail to Me

FAQ and Trouble Shooting

Any questions and comments are welcome to me.

Index:

  1. How can I handle the request to the virtual hosts on Apache?
  2. JServ fails to start JVM with SSL enabled Apache
  3. How can I compile JServ into Apache statically?

1: Request to the virtual host

Q: How can I handle the request to the virtual hosts on Apache?

A: The mapping of the path of the request URI to the context can be done by 'ApJServMount' directive, normaly in jserv.conf(or tomcat.conf) which is specified by 'Include' directive' appended to 'httpd.conf'. For example, with

ApJServMount  /examples   ajpv12://jun_tomcat:8007/examples
the request such as is redirected to the Tomcat servlet server by the JServ module, rather than treated directly by the Apache httpd server. It is translated to the request in the form of and sent to the Tomcat servlet server. Then the Tomcat servlet server searches the servlet 'some_servlet' in the context of '/examples', find and invoke it.
'ApJServMount' directive can be used in the 'VirtualHost' directive of httpd.conf, and in such a case, the request to the virtual server will be redirected to the Tomcat servlet server. It looks like this:
<VirtualHost 205.205.150.103>
    DocumentRoot /export/home/jun/public_html
    ServerName www.juntest.com
    ErrorLog logs/juntest.com-error_log
    CustomLog logs/juntest.com-access_log common
 	<IfModule mod_jserv.c>
	ApJServMount /examples ajpv12://jun_tomcat:8007/examples
 		<Location /examples/WEB-INF/ >
      			AllowOverride None
      			deny from all
 		</Location>  
 	</IfModule>
</VirtualHost>

2: Trouble with SSL enabled Apache

Q: I complied mod_jserv by APXS into the Apache, which is complied with mod_ssl. When Apache starts up with SSL (by 'apachectl sslstart'), JServ fails to start JVM once. After that JServ tries to start JVM again and again between some time interval and finally it succeed. Without SSL (by 'apachectl start'), there is no problem.

A: It is due to the heavy tasks to enable mod_ssl. To avoid this, change the order of the modules to be loaded. In case that mod_jserv is the last module to be loaded, the conflicts with mod_ssl will not occur. Just edit 'httpd.conf' so as to the lines of

and beeing the first line of each dirctive. It looks like bellow:
LoadModule jserv_module       libexec/mod_jserv.so
LoadModule vhost_alias_module libexec/mod_vhost_alias.so
----
----
ClearModuleList
AddModule mod_jserv.c
AddModule mod_vhost_alias.c
Note that the order to be loaded is reverse to the order in 'httpd.conf'.

3: How can I compile JServ into Apache statically?

Q: For some reason, my Apache does not support DSO. How can I compile JServ into Apache statically?

A: To compile JServ into Apache statically, we first compile C source files of JServ module. Then we should put compiled files into the Apache source tree. Now Apache can be re-compiled with JServ statically.
The most difficult thing is to compile C source files of JServ. As you know, C is dependent on the environment. This means we must supply the appropriate command line option. But don't worry. The "configure" tool take care of all the tasks! Such a cool "configure" tool is included in the source distirbution of the original JServ, not in the source distribution of Tomcat.
Visit:

and download the source distirbution.
After extracted, "cd" to the created directory and:
./configure \
    --prefix=/usr/local/jserv \
    --with-apache-src=/opt/local/src/apache_1.3.12 \
    --with-JSDK=/opt/local/jakarta-tomcat/lib/servlet.jar
The options above mean:
--prefix
Where the compiled JServ files will be first resides just after "make". Because we intend to use Tomcat as the Java part, we can think of this directory as the temporaly one.
--with-apache-src
Where the source of Apache is extracted. Under the "src/modules/jserv" below this directory, the compiled JServ files will be installed by "make install".
--with-JSDK
The JAR file which contains all the Servlet interfaces. Yes, we have already have such a JAR file. It is "jakarta-tomcat/lib/servlet.jar" from the binary distribution of Tomcat. As you notice, we need not compile Java source files, but "configure" tool need this information to prepare all the "Makefile"s.
Running "configure" will generate many "Makefile"s in the source tree of "Apache JServ". But we need only one "Makefile", which is responsible for compiling C source files of JServ. We can find our desired "Makefile" in "src/c/" under the source tree of "Apache JServ". So, "cd" there and: Now the compiled JServ module files are installed under: At this point, we can re-compile our Apache with JServ statically just by:
cd /opt/local/src/apache_1.3.12
./configure \
    --prefix=/usr/local/apache_1.3.12 \
    --activate-module=src/modules/jserv/libjserv.a
make
make install

Java and all Java-based trademarks and logos are trademarks or registered of Sun Microsystems, Inc. in the United States and other countries.


Previous Page Contents Next Page
OOP-Reserch home page

Mail to Me


ALL CONTENTS COPYRIGHT 2000, Jun Inamori. All rights reserved.
Any questions and comments are welcome to Jun Inamori .