Although my knowledge of Apache is pretty good, I'm having a bear of a time getting 
Tomcat/mod_jk configured.  I'm definitely hampered by my lack of Java knowledge - it 
seems each time I try to read one of the installation guides (Tomcat Minimalistic 
User's Guide, Working with mod_jk, etc), I keep hitting some unfamiliar term or 
concept that makes me think I've missed something from ANOTHER document I should have 
read first... and I end up going in circles, never finding quite what I need.  

I'm coming from a PHP background, so my goal is to (if possible) have a similar 
arrangement that I have with PHP.  Currently, I can put my .php files anywhere in the 
HTTP docroot, and Apache's PHP handler will see the extension and process them 
correctly with mod_php.

So I would LIKE to be able to have .jsp files anywhere in my docroot.  And I would 
LIKE to have servlet files under one particular directory (/share-servlet) which will 
be right above the HTTP docroot.  (Is it a Bad Thing (or even possible) to have a 
servlet directory that is actually *below* the webserver's docroot?)

(oh, one note before I go on - I was quite confused with all the talk about mod_jserv 
and mod_jk until it dawned on me that mod_jk has superceded mod_jserv.  Is that right? 
 If so, when will the User's Guide be updated?)

Tomcat is installed in /usr/local/tomcat/(conf|lib|webapps|etc.)  The Apache docroot 
is /home/httpd/website .  The servlets will go under /home/httpd/share/servlet

Now here's what I did for JSP - see if this was right: 

1) added the following to /usr/local/tomcat/server.xml:

        <Context path="/"
                 docBase="/home/httpd/website"
                 crossContext="true"
                 debug="0"
                 reloadable="true"
                 trusted="false" >
        </Context>
2) Created /home/httpd/website/test.jsp
3) Ran http://www.mysite.foo/test.jsp

which seemed to work.  So was that all I needed to do?  (The directive "JkMount /*.jsp 
ajp13" had already been loaded by the auto-generated mod_jk.conf (which I've modified, 
copied to mod_jk.mysite.conf, and accessed via an Include directive in Apache's 
httpd.conf )

My attempts to get servlets working didn't turn out so well.  Again, I'm probably 
inhibited by my lack of Java knowledge (Tomcat is hopefully going be the start of my 
Java training), but I tried the following:

1) Added this to /usr/local/tomcat/server.xml:

        <Context path="/share-servlet"
                 docBase="/home/httpd/share/servlet"
                 crossContext="true"
                 debug="0"
                 reloadable="true"
                 trusted="false" >
        </Context>

2) Added this to my mod_jk.mysite.conf :

        Alias /share-servlet "/home/httpd/share/servlet"
        <Directory "/home/httpd/share/servlet">
            Options Indexes FollowSymLinks
        </Directory>
        JkMount /share-servlet/* ajp13

3) Compiled and created /home/httpd/share/servlet/HelloWorld.class

4) Attempted to access http://www.mysite.foo/share-servlet/HelloWorld

but this time I got a 404 error (generated by Tomcat, not Apache).

I know the examples that came with tomcat under 
/usr/local/tomcat/webapp/(admin|test|examples) contains all kinds of things like 
META-INF and WEB-INF directories, .war files, etc. but I really don't know how they 
all work.  But I don't want to have to run my servlets out of /usr/local/tomcat/* if I 
can help it.  Do I need some/all of those files/directories under 
/home/httpd/share/servlet if that's where I want my servlets to go?

Thanks to anyone who can point me in the right direction.

------------------------------------------------------------
--== Sent via Deja.com ==--
http://www.deja.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to