You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Lian, Xiaobu (Alice) (Xiaobu (Alice))" <li...@agere.com> on 2001/04/22 21:54:51 UTC

mod_jk.conf configuration: Access servlets from apache server wi th url /servlets/

I have installed mod_jk, and put "include
/usr/local/tomcat/conf/mod_jk.conf-auto" 
in httpd.conf.  So I can run tomcat 3.2.1 and apache 1.3.19 on hp-ux 11.00.

I have a configuration question and hope somebody can give me a clue.

Our existing servlet classes are in /home/someDir/servlets/ directory.  Our
people
want to keep the same url as <servername>/servlets/<servlet-class>.  
I configured tomcat to access it by using url:
server:8090/servlets/<classname>, 
the same way they are running on other web server. 

What I did was 
   1) add context in server.xml with the path ="/" pointing to
/home/someDir.
   2) changed prefix from "servlet" to "servlets" in server.xml
   3) in web.xml, set <url-pattern> /servlets  (Is this necessary?)
   4) symbolic link: /home/someDir/WEB-INF/classes -->
/home/someDir/servlets

So I can access from tomcat by http://ourserver:8090/servlets/TestServlet
It works on tomcat. (I wonder if this is the right way to deal with our
situation?)

However, when I access the same servlet class from apache (default port 80),

http://ourserver/servlets/TestServlet, I see the "Save As" window
open with "TestServlet.html" displayed in the File name field.  It seems
apache does
not communicate with tomcat correctly.  

So I changed the include statement in httpd.conf, using mod_jk.conf-local
instead.
I tried to play with the mod_jk.conf-local to find a way to make it work,
but failed.

I found I could configure server.xml and mod_jk.conf-local using any alias
preceding 
"/servlets", then the servlet class under /home/someDir/servlets will work
when access
from both tomcat (port 8090) and apache (default port ).  The urls look like
the following:
  tomcat:    http://ourserver:8090/mytest/servlets/TestServlet
  apache:    http://ourserver/mytest/servlets/TestServlet

But this is not what we want.  Is there any way we can configure
apache/tomcat so that we
can access /servlets directly from the apache server root?

Thanks for any information!

Alice

Xiaobu Alice Lian
lianx@agere.com
(484)397-2583