Return-Path: Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 31582 invoked from network); 23 Sep 2000 18:00:18 -0000 Received: from mnmai05.mn.mediaone.net (24.131.1.59) by locus.apache.org with SMTP; 23 Sep 2000 18:00:18 -0000 Received: from SHYLOCK.syntegra.com (nic-31-c20-170.mn.mediaone.net [24.31.20.170]) by mnmai05.mn.mediaone.net (8.8.7/8.8.7) with ESMTP id OAA27842 for ; Sat, 23 Sep 2000 14:00:12 -0400 (EDT) Message-Id: <5.0.0.25.2.20000923115041.0386ddf8@mail.creativeis.com> X-Sender: jkjome@mail.creativeis.com X-Mailer: QUALCOMM Windows Eudora Version 5.0 Date: Sat, 23 Sep 2000 13:02:50 -0500 To: tomcat-user@jakarta.apache.org From: Jacob Kjome Subject: Re: Servlet configuration In-Reply-To: <00092312423001.20920@cc153170-a> References: <5.0.0.25.2.20000923102004.03000740@mail.creativeis.com> <83E2D910156DD211B0B700805FE2C5D10ABBECAE@02usnjrarps0mi0.win.us.ups.com> <5.0.0.25.2.20000923102004.03000740@mail.creativeis.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=====================_59637944==_.ALT" X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N --=====================_59637944==_.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed Well, actually, I have apache web server 1.3.12 installed and am visiting my servlets through the default port 80 for apache rather than 8080 and all my servlets work exactly the same whether I go to either port. I can refer to them in the same way base on how I aliased them in the web.xml. So, I am integrating Apache web server and Tomcat. You are right to wonder about the tomcat.conf file -vs-the tomcat-apache.conf file. I found that I needed a file that was separate from the automatically generated one to add my own stuff to it and not have it erased each time Tomcat was restarted. I include the tomcat.conf file in Apache's httpd.conf and all works well. Arrrgggghhhh..... forgot to mention something.... this might clear things up. I had found a bug and fixed it to for my needs, but then forgot that I made that change and now confused this whole issue. However, it still does not require the use of . Read on... When I moved from using Tomcat 3.1 to using Tomcat 3.2 b3, I switched from using ApacheModuleJServ to using mod_jk. an automatically generated config file is created when Tomcat is started: mod_jk.conf-auto (this file serves the same purpose as tomcat-apache.conf did when using ApacheModuleJServ) There is another file called mod_jk.conf (this file serves the same purpose as the tomat.conf did when using ApacheModuleJServ) I found that my aliases in the web.xml for each app were not being recognized when using tomcat through apache web server. I found I had to add new JkMounts manually for any alias I wanted recognized by apache. For instance, here is what Tomcat, by default, writes out in the mod_jk.conf-auto file for a context called "jakefirst": JkMount /jakefirst/servlet/* ajp12 JkMount /jakefirst/*.jsp ajp12 However, I had a couple of servlet aliases that needed to be read. I solved this by taking everything that the mod_jk.conf-auto had in it and copied it over to the mod_jk.conf. Then, added two more entries into the mod_jk.conf file: JkMount /jakefirst/jakehello ajp12 JkMount /jakefirst/secondinstance ajp12 I included the mod_jk.conf file rather than mod_jk.conf-auto in my httpd.conf. Now, Tomcat + Apache web server recognized my aliases that were set in the web.xml file. Again, all this was done without the use of . So, where does this leave us? I think it leaves us with a couple questions: 1. Is only useful for the old JServ module or is it just an alternative to using JkMount???? 2. Why isn't each webapp context's web.xml not being read and having servlet mappings translated automagically into JkMount entries???? There are two issues related to this one: a. By using the mod_jk.conf rather than the automatically generated mod_jk.conf-auto, you have to remember to update the static file with new stuff if you add any new contexts to Tomcat. b. In addition, you need to duplicate efforts where EVERY time you add a new alias to ANY web.xml in ANY context, you will need to manually add JkMount entry in your mod_jk.conf in order for Apache to read your aliases! I detailed this here: http://archives2.real-time.com/pipermail/tomcat-users/2000-September/009686.html Also, take a look at messages containing the subject: "Tomcat not reading Context's web.xml" Also, as far as your comment "We also differ in that my goal was to shorten the path, not lengthen it", I am shortening it. Instead of: http://localhost/mycontext/servlet/com.a.b.c.d.e.SomeServlet I put: JkMount /mycontext/someservlet ajp12 into my mod_jk.conf and I can use: http://localhost/mycontext/someservlet That looks like shortening to me? Also, I don't dispute the use of Model2 architecture. Does that clear things up? Any comments? Actually, if nothing else, I would like to know what your opinion on this whole mod_jk.conf-auto not reflecting each context's web.xml. Thanks, Jake At 11:51 AM 9/23/2000 -0400, you wrote: >Jake, > >I'm glad you have something that works. The LocationMatch >directive tells Apache to direct a particular url-pattern >to a servlet instead of an html file. If you use port 8080 or run >tomcat-jakarta stand-alone, the url-pattern directive is sufficient. But >if you integrate Apache and Jakarta, you need the LocationMatch >directive -- as far as I know. > >Are you using Apache? When you say, "you just need to provide >something like the following to your tomcat.conf file", I begin >to suspect that you are not integrating Apache and Tomcat. >Tomcat generates a file called tomcat-apache.conf each >time it is started. Unless you are doing your own thing, you >should consider using the tomcat-apache.conf file. It permits >Apache to handle html files and tomcat to handle jsps and servlets. >This is discussed in "Setting Tomcat to Cooperate with the Apache Web Server" >in $TOMCAT_HOME/doc/uguide/tomcat_ug.html. > >I found the url-pattern only worked when I came to >the pages through jakarta-tomcat's port 8080. When I came >through Apache, I got page not found errors. The solution >to that problem was to use LocationMatch. > >The reason I needed aliasing may be quite different from >from your reasons. And perhaps that explains why you may >be satisfied setting the context path, while I need more >flexibility. We also differ in that my goal was to shorten the path, >not lengthen it. > >The aliasing discussed on JGuru is useful for a Model 2 architecture >where *ALL* requests to a context are first sent to a dispatching servlet. >That servlet looks at the pathinfo() and then re-directs the request >to the appropriate page or servlet. This centralized approach >has benefits for security, logging, and dynamic reconfiguration >of paths. It also permits you to hide the implementation details -- >you can use cgi-bin instead of servlet, you can end your files >with .pl instead of .jsp, and so on. > > Ken. > >On Sat, 23 Sep 2000, you wrote: > > > > Hmmm... I'm a bit confused here. > > > > My example covers the first one you mention. It does go into a little > more > > detail with using the getPathInfo() method but, for the most part, it is > > exactly what my example said. > > > > On the second one, I'm not sure I see where the problem is. It says to > add > > the following to tomcat.conf or tomcat-apache.conf to support servlet > > aliasing between Apache+Tomcat: > > > > > > SetHandler jserv-servlet > > > > > > However, I have this working quite nicely without doing that at all. It > > think that is a Jserv ONLY issue. With Tomcat, you just need to provide > > something like the following to your tomcat.conf file: > > > > Alias /examples "C:/Program Files/Apache > Group/Jakarta/tomcat/webapps/examples" > > > > Options Indexes FollowSymLinks > > > > ApJServMount /examples/servlet /examples > > > > AllowOverride None > > deny from all > > > > > Group/Jakarta/tomcat/webapps/examples/WEB-INF/"> > > AllowOverride None > > deny from all > > > > > > AllowOverride None > > deny from all > > > > > Group/Jakarta/tomcat/webapps/examples/META-INF/"> > > AllowOverride None > > deny from all > > > > > > > > In this case, all your aliasing that you have done in your web.xml will > > work just fine through apache. > > > > Am I missing something? Why would I want to use ???? > > > > > > Jake > > > > > > At 10:30 AM 9/23/2000 -0400, you wrote: > > >There are two Q&As on JGuru, which address the issue of > > >aliasing. > > > > > >Check out: > > > > > >How do I use servlet aliasing, so the URL > > >"http://foo.com/mywebapp/servlet/a.b.c.MyServlet" can become > > >"http://foo.com/mywebapp/Thingy"? > > >http://www.jguru.com/jguru/faq/view.jsp?EID=134402 > > > > > >and > > > > > >How do I make servlet aliasing work with Apache+Tomcat? > > >http://www.jguru.com/jguru/faq/view.jsp?EID=140877 > > > > > > Ken. > > > > > > > > >On Fri, 22 Sep 2000, you wrote: > > > > Thanks!!! For my purposes at this point, I can stick with the > "test" root > > > > directory, so your answer solves my problem. I read all about > doing what > > > > you described below, in the docs online, but somehow they didn't > make any > > > > sense at all, and you did. Thanks a bunch! > > > > > > > > Jeff Nibler > > > > > > > > > > > > > -----Original Message----- > > > > > From: Jacob Kjome [mailto:Jacob.R.Kjome@syntegra.com] > > > > > Sent: Friday, September 22, 2000 2:37 PM > > > > > To: 'tomcat-user@jakarta.apache.org' > > > > > Subject: RE: Serlvet configuration > > > > > > > > > > > > > > > in your local web.xml in the /webapps/test/WEB-INF directory, > > > > > you need the > > > > > following: > > > > > > > > > > > > > > > > > > > > Test Servlets > > > > > > > > > > This is where my test servlets are > > > > > > > > > > > > > > > > > > > > myservlet > > > > > ServletName > > > > > > > > > > > > > > > > > > > > myservlet > > > > > > > > > > /here-too/oh-ya-and-even-here/servletname > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > That gets you to the point to pointing to: > > > > > > > > > > http://www.myserver.com/test/here-too/oh-ya-and-even-here/servletName > > > > > > > > > > However, I'm not sure how you would set the directory for the initial > > > > > context to be different than what the directory (called > > > > > "test" in this case) > > > > > in your webapps directory is? > > > > > > > > > > Anyone? This would be good to know. > > > > > > > > > > > > > > > Jake > > > > > > > > > > -----Original Message----- > > > > > From: NIBLER JEFF R. (PDX1JRN) [mailto:pdx1jrn@ups.com] > > > > > Sent: Friday, September 22, 2000 4:26 PM > > > > > To: tomcat-user@jakarta.apache.org > > > > > Subject: Serlvet configuration > > > > > > > > > > > > > > > Hi all, this is my first e-mail to the list, hope I did it > > > > > correctly (the > > > > > FAQ and info E-mail returned nada). Ok, I have one question > > > > > about Tomcat: > > > > > what configuration file, and where in that file, can you > > > > > change the url > > > > > pathing for where your servlet is accessed? For instance, lets > say my > > > > > directory structure looks like: > > > > > C:\tomcat\webapps\test\web-inf\classes > > > > > Now by default (at least, default on my installation), to > > > > > view a servlet via > > > > > the url, you would nee to type: > > > > > http://www.myserver.com/test/servlet/servletName > > > > > So how do I change it so that the url pathing would read: > > > > > http://www.myserver.com/here/here-too/oh-ya-and-even-here/servletName > > > > > ? > > > > > In addition, when I do that, will I need to modify the > > > > > tomcat.conf that > > > > > Apache references if I want Apache to output the results of > > > > > the servlet to > > > > > the client? Thanks in advance for anyone who can help me on this one. > > > > > > > > > > Jeff Nibler > > > > > > > >-- > > >Kenneth R. Kress kkress@home.com > > > >---------------------------------------- >Content-Type: text/html; name="unnamed" >Content-Transfer-Encoding: 7bit >Content-Description: >---------------------------------------- > >-- >Kenneth R. Kress kkress@home.com --=====================_59637944==_.ALT Content-Type: text/html; charset="us-ascii" Well, actually, I have apache web server 1.3.12 installed and am visiting my servlets through the default port 80 for apache rather than 8080 and all my servlets work exactly the same whether I go to either port.  I can refer to them in the same way base on how I aliased them in the web.xml.   So, I am integrating Apache web server and Tomcat.

You are right to wonder about the tomcat.conf file -vs-the tomcat-apache.conf file.  I found that I needed a file that was separate from the automatically generated one to add my own stuff to it and not have it erased each time Tomcat was restarted.  I include the tomcat.conf file in Apache's httpd.conf and all works well.



Arrrgggghhhh.....  forgot to mention something....  this might clear things up.



I had found a bug and fixed it to for my needs, but then forgot that I made that change and now confused this whole issue.   However, it still does not require the use of <LocationMatch>.  Read on...


When I moved from using Tomcat 3.1 to using Tomcat 3.2 b3, I switched from using ApacheModuleJServ to using mod_jk.

an automatically generated config file is created when Tomcat is started:

mod_jk.conf-auto (this file serves the same purpose as tomcat-apache.conf did when using ApacheModuleJServ)

There is another file called mod_jk.conf (this file serves the same purpose as the tomat.conf did when using ApacheModuleJServ)


I found that my aliases in the web.xml for each app were not being recognized when using tomcat through apache web server.

I found I had to add new JkMounts manually for any alias I wanted recognized by apache.

For instance, here is what Tomcat, by default, writes out in the mod_jk.conf-auto file for a context called "jakefirst":

JkMount /jakefirst/servlet/* ajp12
JkMount /jakefirst/*.jsp ajp12

However, I had a couple of servlet aliases that needed to be read.  I solved this by taking everything that the mod_jk.conf-auto had in it and copied it over to the mod_jk.conf.  Then, added two more entries into the mod_jk.conf file:

JkMount /jakefirst/jakehello ajp12
JkMount /jakefirst/secondinstance ajp12

I included the mod_jk.conf file rather than mod_jk.conf-auto in my httpd.conf.  Now, Tomcat + Apache web server recognized my aliases that were set in the web.xml file.

Again, all this was done without the use of <LocationMatch>. 


So, where does this leave us?   I think it leaves us with a couple questions:

1.  Is <LocationMatch> only useful for the old JServ module or is it just an alternative to using JkMount????

2.  Why isn't each webapp context's web.xml not being read and having servlet mappings translated automagically into JkMount entries????
        There are two issues related to this one:
        a.  By using the mod_jk.conf rather than the automatically generated mod_jk.conf-auto, you have to remember to update the static file with new stuff if you          add any new contexts to Tomcat.
        
        b.  In addition, you need to duplicate efforts where EVERY time you add a new alias to ANY web.xml in ANY context, you will need to manually add            JkMount entry in your mod_jk.conf in order for Apache to read your aliases!


I detailed this here:

http://archives2.real-time.com/pipermail/tomcat-users/2000-September/009686.html


Also, take a look at messages containing the subject:
 
"Tomcat not reading Context's web.xml"



Also, as far as your comment "We also differ in that my goal was to shorten the path, not lengthen it", I am shortening it. 

Instead of:

http://localhost/mycontext/servlet/com.a.b.c.d.e.SomeServlet

I put:

JkMount /mycontext/someservlet ajp12

into my mod_jk.conf and I can use:

http://localhost/mycontext/someservlet

That looks like shortening to me?


Also, I don't dispute the use of Model2 architecture. 

Does that clear things up?  Any comments?  Actually, if nothing else, I would like to know what your opinion on this whole mod_jk.conf-auto not reflecting each context's web.xml. 

Thanks,


Jake



At 11:51 AM 9/23/2000 -0400, you wrote:
Jake,

I'm glad you have something that works. The LocationMatch
directive tells Apache to direct a particular url-pattern
to a servlet instead of an html file. If you use port 8080 or run
tomcat-jakarta stand-alone, the url-pattern directive is sufficient. But
if you integrate Apache and Jakarta, you need the LocationMatch
directive -- as far as I know.

Are you using Apache? When you say, "you just need to provide
something like the following to your tomcat.conf file", I begin
to suspect that you are not integrating Apache and Tomcat.
Tomcat generates a file called tomcat-apache.conf each
time it is started. Unless you are doing your own thing, you
should consider using the tomcat-apache.conf file. It permits
Apache to handle html files and tomcat to handle jsps and servlets.
This is discussed in "Setting Tomcat to Cooperate with the Apache Web Server"
in $TOMCAT_HOME/doc/uguide/tomcat_ug.html.

I found the url-pattern only worked when I came to
the pages through jakarta-tomcat's port 8080. When I came
through Apache, I got page not found errors. The solution
to that problem was to use LocationMatch.

The reason I needed aliasing may be quite different from
from your reasons. And perhaps that explains why you may
be satisfied setting the context path, while I need more
flexibility. We also differ in that my goal was to shorten the path,
not lengthen it.

The aliasing discussed on JGuru is useful for a Model 2 architecture
where *ALL* requests to a context are first sent to a dispatching servlet.
That servlet looks at the pathinfo() and then re-directs the request
to the appropriate page or servlet. This centralized approach
has benefits for security, logging, and dynamic reconfiguration
of paths. It also permits you to hide the implementation details --
you can use cgi-bin instead of servlet, you can end your files
with .pl instead of .jsp, and so on.

   Ken.

On Sat, 23 Sep 2000, you wrote:
>
> Hmmm... I'm a bit confused here.
>
> My example covers the first one you mention.  It does go into a little more
> detail with using the getPathInfo() method but, for the most part, it is
> exactly what my example said.
>
> On the second one, I'm not sure I see where the problem is.  It says to add
> the following to tomcat.conf or tomcat-apache.conf to support servlet
> aliasing between Apache+Tomcat:
>
> <LocationMatch /myApp/jsp-bin/* >
>      SetHandler jserv-servlet
> </LocationMatch>
>
> However, I have this working quite nicely without doing that at all.  It
> think that is a Jserv ONLY issue.  With Tomcat, you just need to provide
> something like the following to your tomcat.conf file:
>
> Alias /examples "C:/Program Files/Apache Group/Jakarta/tomcat/webapps/examples"
> <Directory "C:/Program Files/Apache Group/Jakarta/tomcat/webapps/examples">
>      Options Indexes FollowSymLinks
> </Directory>
> ApJServMount /examples/servlet /examples
> <Location "/examples/WEB-INF/">
>      AllowOverride None
>      deny from all
> </Location>
> <Directory "C:/Program Files/Apache
> Group/Jakarta/tomcat/webapps/examples/WEB-INF/">
>      AllowOverride None
>      deny from all
> </Directory>
> <Location "/examples/META-INF/">
>      AllowOverride None
>      deny from all
> </Location>
> <Directory "C:/Program Files/Apache
> Group/Jakarta/tomcat/webapps/examples/META-INF/">
>      AllowOverride None
>      deny from all
> </Directory>
>
>
> In this case, all your aliasing that you have done in your web.xml will
> work just fine through apache.
>
> Am I missing something?  Why would I want to use <LocationMatch>????
>
>
> Jake
>
>
> At 10:30 AM 9/23/2000 -0400, you wrote:
> >There are two Q&As on JGuru, which address the issue of
> >aliasing.
> >
> >Check out:
> >
> >How do I use servlet aliasing, so the URL
> >"http://foo.com/mywebapp/servlet/a.b.c.MyServlet" can become
> >"http://foo.com/mywebapp/Thingy"?
> >http://www.jguru.com/jguru/faq/view.jsp?EID=134402
> >
> >and
> >
> >How do I make servlet aliasing work with Apache+Tomcat?
> >http://www.jguru.com/jguru/faq/view.jsp?EID=140877
> >
> >   Ken.
> >
> >
> >On Fri, 22 Sep 2000, you wrote:
> > > Thanks!!!  For my purposes at this point, I can stick with the "test" root
> > > directory, so your answer solves my problem.  I read all about doing what
> > > you described below, in the docs online, but somehow they didn't make any
> > > sense at all, and you did.  Thanks a bunch!
> > >
> > > Jeff Nibler
> > >
> > >
> > > > -----Original Message-----
> > > > From: Jacob Kjome [mailto:Jacob.R.Kjome@syntegra.com]
> > > > Sent: Friday, September 22, 2000 2:37 PM
> > > > To: 'tomcat-user@jakarta.apache.org'
> > > > Subject: RE: Serlvet configuration
> > > >
> > > >
> > > > in your local web.xml in the /webapps/test/WEB-INF directory,
> > > > you need the
> > > > following:
> > > >
> > > > <web-app>
> > > >
> > > >     <display-name>Test Servlets</display-name>
> > > >     <description>
> > > >     This is where my test servlets are
> > > >     </description>
> > > >
> > > >     <servlet>
> > > >         <servlet-name>myservlet</servlet-name>
> > > >         <servlet-class>ServletName</servlet-class>
> > > >     </servlet>
> > > >
> > > >     <servlet-mapping>
> > > >         <servlet-name>myservlet</servlet-name>
> > > >
> > > > <url-pattern>/here-too/oh-ya-and-even-here/servletname</url-pattern>
> > > >     </servlet-mapping>
> > > >
> > > >
> > > > </web-app>
> > > >
> > > > That gets you to the point to pointing to:
> > > >
> > > > http://www.myserver.com/test/here-too/oh-ya-and-even-here/servletName
> > > >
> > > > However, I'm not sure how you would set the directory for the initial
> > > > context to be different than what the directory (called
> > > > "test" in this case)
> > > > in your webapps directory is?
> > > >
> > > > Anyone?  This would be good to know.
> > > >
> > > >
> > > > Jake
> > > >
> > > > -----Original Message-----
> > > > From: NIBLER JEFF R. (PDX1JRN) [mailto:pdx1jrn@ups.com]
> > > > Sent: Friday, September 22, 2000 4:26 PM
> > > > To: tomcat-user@jakarta.apache.org
> > > > Subject: Serlvet configuration
> > > >
> > > >
> > > > Hi all, this is my first e-mail to the list, hope I did it
> > > > correctly (the
> > > > FAQ and info E-mail returned nada).  Ok, I have one question
> > > > about Tomcat:
> > > > what configuration file, and where in that file, can you
> > > > change the url
> > > > pathing for where your servlet is accessed?  For instance, lets say my
> > > > directory structure looks like:
> > > > C:\tomcat\webapps\test\web-inf\classes
> > > > Now by default (at least, default on my installation), to
> > > > view a servlet via
> > > > the url, you would nee to type:
> > > > http://www.myserver.com/test/servlet/servletName
> > > > So how do I change it so that the url pathing would read:
> > > > http://www.myserver.com/here/here-too/oh-ya-and-even-here/servletName
> > > > ?
> > > > In addition, when I do that, will I need to modify the
> > > > tomcat.conf that
> > > > Apache references if I want Apache to output the results of
> > > > the servlet to
> > > > the client? Thanks in advance for anyone who can help me on this one.
> > > >
> > > > Jeff Nibler
> > > >
> >--
> >Kenneth R. Kress                                kkress@home.com
>

----------------------------------------
Content-Type: text/html; name="unnamed"
Content-Transfer-Encoding: 7bit
Content-Description:
----------------------------------------

--
Kenneth R. Kress                                kkress@home.com
--=====================_59637944==_.ALT--