Do Java Servlets Have to Be Under Apache's ServerRoot?

Do Java Servlets Have to Be Under Apache's ServerRoot?

Post by EricFe » Mon, 27 Apr 1998 04:00:00



In trying to use two different kinds of servlet engines (JServ from the
Java-Apache Project, and JRun from LiveSoftware).  In both cases, I get the
following error
when I try to access the test servlets that come with the respective servlet
engines.  Do the servlets have to be somewhere under the directory specified as
my ServerRoot in Apache (e.g., /web/httpd/htdocs/servlets)?   Other than the
servlet stuff, my web server runs beautifully --- can't complain.

I've got the code for _both_ servlet engines compiled into my Apache
executable, but I only use one servlet engine (JServ or JRun) at a time.  As
best I can tell, I'm able to properly configure and invoke either servlet
engine when I start Apache.  I use <IfModule> directives to provide Apache with
the appropriate configuration info for the given servlet engine I'm trying to
run, and I comment out the "AddModule" line for the servlet engine that I'm NOT
using --- this seems to work, too.  All of the configuration stuff appears to
be fine, but neither JRun nor JServ can find the servlets.

After I start up Apache, I don't get any errors from the servlet engine I try
to run---neither from JServ or from  JRun (JRun, in its case, is properly
invoked by Apache and run as a separate process).

I'm using the appropriate directives for the respective servlet engines to make
an alias for my servlet directories

*** For JServ, in the Apache config file (httpd.conf), I set:

ServletAlias     /servlets   /apps/JSDK/servlets

*** In JRun's graphical JRunAdmin utility, I set an alias:

/servlets   /apps/JSDK/servlets

*** Here's the error I get:

e.g.,

http://<my domain name>/servlets/HelloWorldServlet

Returns this ...

   403:  Access Forbidden

   You do not have permission to access the desired resource.

I can see in my error logs and access logs where Apache is trying to fetch the
servlets, but access is forbidden.  I've got <Directory> directives set for the
root ( '/' ) directory, "/cgi-bin", and for "/web/httpd/htdocs" (my
DocumentRoot), but that's it.

Note that the error is _not_ that the files I'm trying to access don't exist
(it's not error code 404).  The servlets _really are_ in the
/apps/JSDK/servlets directory, and appropriate file and directory permissions
are applied to let folks get to that directory.  For the servlets themselves, I
have the  644 permission set, and the ownership is nobody:http.  

I'm baffled.  Do the servlets have to be somewhere under the directory
specified as my ServerRoot in Apache (e.g., /web/httpd/htdocs/servlets)?  If
anyone has any ideas why this might be happening, please send me a reply.

Thx - Eric