You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Evan J <ma...@gmail.com> on 2006/08/20 00:37:03 UTC

JkMount and Context path

I've a question regarding the way jk_mod relays requests to Tomcat
servlets. If I have set my virtualhost to supposedly send requests
with such JkMount directive URL prefix, /serve/* and /serve/*.jsp,
then I take it, the only way for jk_mod relays requests for this
virtualhost to Tomcat web application listening on the other end is
the actual web application "name" (or directory where it is located)
to be "serve".

On other hand, if the JkMount directive is /*/eservlets/* (or
/*/eservlets/*.jsp), then all the web applications that have a servlet
/eservlets/* mapping are being granted such connection between
Apache->jk_mod->Tomcat instance. So now, what if we change the web
application's Context's path, that is <Context path="/someuri"...>,
then how is the servlet with /eservlets/* mapping is going to be
accessed?

Would it be http://vh.host.com/someuri/myapp/eservlets/myservlet or
perhaps, http://vh.host.com/myapp/someuir/eservlets/myservlet
(assuming the web application name is "myapp"? In any case, the former
would produce HTTP 400 and the latter HTTP 404. So obviously Context
path has no bearing in accessing the servlets, that is
http://vh.host.com/myapp/eservlets/myservlet works just fine but
inclusion of "someuri" would result in HTTP 400. So what is going on?

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JkMount and Context path

Posted by Martin Gainty <mg...@hotmail.com>.
Apache is and always will be a CGI processor..for that reason I like Tomcat to run standalone 
(If someone changes the httpd.conf  or worker.properties files your config is hosed..)

*In either case I'm glad that helped you*

Martin --
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Evan J " <ma...@gmail.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Monday, August 21, 2006 9:28 AM
Subject: Re: JkMount and Context path


> Martin,
> 
> Indeed, I had the same setting with the standalone Tomcat webserver
> and the configuration your mention would work properly as it expected.
> As I had mentioned in earlier posts to this thread, I do not have a
> reason to utilize a third party webserver. At this point I am just
> trying various configuration as a means of "learning" in case in the
> future I end up be needing to deploy Tomcat in such environment.
> 
> Sincerely,
> 
> Evan
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
>

Re: JkMount and Context path

Posted by Evan J <ma...@gmail.com>.
Martin,

Indeed, I had the same setting with the standalone Tomcat webserver
and the configuration your mention would work properly as it expected.
As I had mentioned in earlier posts to this thread, I do not have a
reason to utilize a third party webserver. At this point I am just
trying various configuration as a means of "learning" in case in the
future I end up be needing to deploy Tomcat in such environment.

Sincerely,

Evan

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JkMount and Context path

Posted by Martin Gainty <mg...@hotmail.com>.
Evan

If apache is installed on a standalone webserver it will work cleaner and 
faster
If tomcat is installed on a standalone webserver it will work cleaner and 
faster..

but if you absolutely positively need apache and tomcat on the same 
host..although you still havent explained why this is the case!!!

#httpd.conf
JkMount /*.jsp worker1
JkMount /*/servlet/ worker1

#http://<host>/*.jsp  routes to worker1
#http://<host>/servlet routes to worker1

#BOTH get sent to the worker1 connector which is configured as
#workers.properties
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13

#accordingly server.xml picks up all requests directed to port 8009
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
                port="8009" minProcessors="5" maxProcessors="75"
                enableLookups="true" redirectPort="8443"
                acceptCount="10" debug="0" connectionTimeout="0"
                useURIValidationHack="false"

#In other words ALL *.jsp and ALL servlets are routed to Tomcat
#so in your ./META-INF/context.xml
#The web application used to process each HTTP request is selected by 
Catalina based on matching #the longest possible prefix of the Request URI 
against the context path of each defined Context. #Once selected, that 
Context will select an appropriate servlet to process the incoming request, 
#according to the servlet mappings defined in the web application deployment 
descriptor file (which #MUST be located at /WEB-INF/web.xml within the web 
app's directory hierarchy).

#so in other words context.xml path= "foo" will direct to the 
servlet-mapping for identifier "foo"
<Context path="/foo">

#and web.xml has declared a mapping for foo as in
<servlet-mapping>
        <servlet-name>foo</servlet-name>
        <url-pattern>/servlet/foo</url-pattern>
</servlet-mapping>

#then your ultimate path will be

$TOMCAT_HOME/webapps/servlet/foo

Martin --

______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official 
business of Sender. This transmission is of a confidential nature and Sender 
does not endorse distribution to any party other than intended recipient. 
Sender does not necessarily endorse content contained within this 
transmission.

>
>Yes, I understand that perfectly. What I am asking is what if we
>include a web application Context path, that is <Context
>path="someuri"...>. Of course, JkMount /*/eservlet/* would relay all
>the request with mywebapp/eservlet/* from Apache to Tomcat -- I am
>aware of that. Now if we set <Context path="someuri"...>, what is
>going to happen to our URI?
>
>Here's an excerpt from Tomcat config document:
>
>"The context path of this web application, which is matched against
>the beginning of each request URI to select the appropriate web
>application for processing. All of the context paths within a
>particular Host must be unique. If you specify a context path of an
>empty string (""), you are defining the default web application for
>this Host, which will process all requests not assigned to other
>Contexts. The value of this field must not be set except when
>statically defining a Context in server.xml, as it will be infered
>from the filenames used for either the .xml context file or the
>docBase."
>
>So when Apache webserver gets a request for a particular virtualhost,
>jk_mod sees if the request must be handled by Tomcat (i.e. satisfies
>/*/eservlet/*) or not. If it does, it relays it to the appropriate
>host and depending on "path" which is defined above, finally the
>request is handed to the appropriate context or web application
>designated for that "Host" (based on that "path", again according to
>the excerpt above).  Now, having specified the "path," how are we
>going to access a servlet with such scenario? I gave a straightforward
>example but you still didn't answer my question.
>
>On 8/20/06, Martin Gainty <mg...@hotmail.com> wrote:
>>Why are you mixing up Apache and Tomcat?
>>
>>If you are speaking of AJP 'context' term
>>  if you look at the doc you will see
>>JkMount [URL prefix] [Worker name]
>>/*where URL prefix is the context*/
>>JkMount /*/esrvlt/* worker1
>>Send all requests of whateverWebApp/eservlet/WhateverFileName to worker1 
>>so in essence
>>http://<host>/*/eservlet/<anything>
>>will be directed to Tomcat
>>
>>Assuming your workers.properties has this configuration
>>#workers.properties
>>worker.worker1.port=8009
>>worker.worker1.host=localhost
>>worker.worker1.type=ajp13
>>
>>/*Now all tomcat requests are redirected to localhost on port 8009*/
>>/*Inside $TOMCAT_HOME/conf/server.xml you have a connector which will 
>>listen on port 8009*/
>>    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
>>       <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
>>                port="8009" minProcessors="5" maxProcessors="75"
>>                enableLookups="true" redirectPort="8443"
>>                acceptCount="10" debug="0" connectionTimeout="0"
>>                useURIValidationHack="false"
>>                
>>protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
>>
>>Martin --
>>*********************************************************************
>>This email message and any files transmitted with it contain confidential
>>information intended only for the person(s) to whom this email message is
>>addressed.  If you have received this email message in error, please 
>>notify
>>the sender immediately by telephone or email and destroy the original
>>message without making a copy.  Thank you.
>>
>>
>>
>>----- Original Message -----
>>From: "Evan J " <ma...@gmail.com>
>>To: "Tomcat Users List" <us...@tomcat.apache.org>; "Martin Gainty" 
>><mg...@hotmail.com>
>>Sent: Sunday, August 20, 2006 1:15 PM
>>Subject: Re: JkMount and Context path
>>
>>
>> > Martin,
>> >
>> > I have the documents and I'm aware the difinition of Context path and
>> > from what you have posted, it says, "It is matched against the
>> > requesting URI." Now, my question was having Context path set, what
>> > would the appropriate URI in case that the system utilizes Apache and
>> > jk_mod in which JkMount is used for the requests to be processes by
>> > jk_mod and passed on to Tomcat? Allow me to restate my example, so you
>> > will be able to answer my question through the example itself.
>> >
>> > JkMount /*/esrvlt/* worker1
>> > JkMount /*/esrvlt/*.jsp worker1
>> >
>> > The web application is "myapp"
>> > Context path is "/someuri"
>> > One of the servlet mapping in web.xml is "/esrvlt/myservlet"
>> >
>> > Now given that, how should "myservlet" be accessed, that is the actual
>> > URL must look like?
>> >
>> > http://vh.host.com/myapp/esrvlt/myservlet OR
>> > http://vh.host.com/someuri/myapp/esrvlt/myservlet OR
>> > Must it have a different set of configuration (jkMount, path, mapping)
>> > in order to be accessed properly? Or Context path in such situation
>> > has no bearing? Please answer through forementioned scenario.
>> >
>> > And as for using Apache webserver... I am just playing around with
>> > different configuration in order to understand how they interact with
>> > each other. For now, I have no need to utilize a third party web
>> > server. Although, that being said, I can see usage for having a front
>> > end web server to, for example, pass on the load balancing to it
>> > rather than let Tomcat's handle it. And as you have posted, directives
>> > such as JkAutoAlias/JkMount/JkUnMount would allow me to process those
>> > files that can be statistically served such as .gif or .html and
>> > dynamic content to be passed on and handled by Tomcat (or any other
>> > web container).
>> >
>> > Sincerely,
>> >
>> > Evan
>> >
>> >
>> > On 8/20/06, Martin Gainty <mg...@hotmail.com> wrote:
>> >> <Context path="/urlPath" docBase="/com/packagename" ... >
>> >> #path is the context path of the webapp which is matched against the 
>>requesting URI to choose appropriate webapp to process (all paths must be 
>>unique)
>> >> #docBase maps the urlPath to physical docBase (which can either be 
>>absolute path or relative to webapps)
>> >> #embedding context elements within server.xml has been replaced by 
>>encapsulating context.xml for each webapp 
>>#$CATALINA_HOME/webapps/WebApp/META-INF/context.xml
>> >>
>> >> #within context You also have the capability of passing in 
>>initialisation parameters via <Parameter in context.xml
>> >> #or Environment settings via <Environment parameter
>> >>
>> >> #If you have JDBC resources You can also declare ResourceParams for 
>>jdbc connections via <ResourceParams
>> >>
>> >> #You can also declare global JNDI resource via <ResourceLink
>> >>
>> >> Doc available at
>> >> http://tomcat.apache.org/tomcat-5.0-doc/config/context.html
>> >>
>> >> Mod-jk
>> >> #mod_jk JkAutoAlias maps all web application context directories into 
>>Apache document space..you DONT want to do this if you want to give Tomcat
>> >> #control of the folder as in the example illustrated here
>> >> JkAutoAlias /export/home/web/host2/webapps
>> >>
>> >> JkMount /*.jsp ajp13
>> >> JkMount /*/servlet/ ajp13
>> >>
>> >> #A single webapp mapped into Apache document space can be accomplished 
>>via Alias as in this example
>> >>  Alias /examples /export/home/web/host1/webapps/examples
>> >>  JkMount /*.jsp ajp13
>> >>  JkMount /*/servlet/ ajp13
>> >>
>> >> All of this depends on how you are configuring your Context listener 
>>as in this example
>> >> <Host name="localhost" debug="0" appbase="webapps" >
>> >>       <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
>> >>           append="true"  forwardAll="true"/ >
>> >> />
>> >> #where the most significant parameter forwardAll = "true" will direct 
>>apache to forward your context listener requests to tomcat
>> >> #verify these settings by viewing mod-jk.conf
>> >>
>> >> The only question I have is why not let tomcat run standalone?
>> >> M-
>> >> *********************************************************************
>> >> This email message and any files transmitted with it contain 
>>confidential
>> >> information intended only for the person(s) to whom this email message 
>>is
>> >> addressed.  If you have received this email message in error, please 
>>notify
>> >> the sender immediately by telephone or email and destroy the original
>> >> message without making a copy.  Thank you.
>> >>
>> >>
>> >>
>> >> ----- Original Message -----
>> >> From: "Evan J " <ma...@gmail.com>
>> >> To: "Tomcat Users List" <us...@tomcat.apache.org>; "Martin Gainty" 
>><mg...@hotmail.com>
>> >> Sent: Sunday, August 20, 2006 1:01 AM
>> >> Subject: Re: JkMount and Context path
>> >>
>> >>
>> >> > Ok, your answer just recaps everything that is needed to run
>> >> > Apache-jk_mod-Tomcat but does not answer my question. What if in 
>>your
>> >> > setting, you have set Context path, what would be the consequences?
>> >> > How are the servlets then are accessed? Is it required to include
>> >> > Context path in the uri ending to the servlet like the examples are
>> >> > provided earlier? It seems like that is not the case so I am taking 
>>it
>> >> > either Context path, if it's designated, has no bearing when it 
>>comes
>> >> > to jk_mod or must be included in the uri in some other way.
>> >> >
>> >> > On 8/19/06, Martin Gainty <mg...@hotmail.com> wrote:
>> >> >> /*httpd.conf
>> >> >> JkMount maps all JSP (*.jsp) to ajp13
>> >> >> */
>> >> >> e.g.
>> >> >> httpd.conf
>> >> >> JkMount /*.jsp ajp13
>> >> >>
>> >> >> /*map ajp13 to your webapp docRoot /var/tomcat4/webapps/domain1
>> >> >> <VirtualHost *>
>> >> >>     ServerName domain1.com
>> >> >>     ServerAlias www.domain1.com
>> >> >>     DocumentRoot /var/tomcat4/webapps/domain1
>> >> >>     JkMount /* ajp13
>> >> >> </VirtualHost>
>> >> >>
>> >> >> /*server.xml maps known webapp docBase /var/tomcat4/webapps/domain 
>>to domain name(domain1) via this entry*/
>> >> >> <Host name="domain1.com" debug="0" appBase="webapps" 
>>unpackWARs="true">
>> >> >> <Alias>www.domain1.com</Alias>
>> >> >> <Logger className="org.apache.catalina.logger.FileLogger"
>> >> >> directory="logs" prefix="virtual_log1." suffix=".log" 
>>timestamp="true"/>
>> >> >> <Context path="" docBase="/var/tomcat4/webapps/domain1" debug="0" 
>>reloadable="true"/>
>> >> >> </Host>
>> >> >>
>> >> >> HTH
>> >> >> M-
>> >> >
>> >> > 
>>---------------------------------------------------------------------
>> >> > To start a new topic, e-mail: users@tomcat.apache.org
>> >> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> >> > For additional commands, e-mail: users-help@tomcat.apache.org
>> >> >
>> >> >
>> >
>> > ---------------------------------------------------------------------
>> > To start a new topic, e-mail: users@tomcat.apache.org
>> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> > For additional commands, e-mail: users-help@tomcat.apache.org
>> >
>> >
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Context and web.xml

Posted by MC Moisei <mc...@hotmail.com>.
I'm looking to be able to tell context where is the web.xml.

I have two web.xmls one for tomcat and one for weblogic.

web_tc.xml
web_wls.xml

I want to tell tomcat to look into web_tc.xml




>From: "Martin Gainty" <mg...@hotmail.com>
>Reply-To: "Martin Gainty" <mg...@hotmail.com>
>To: "Tomcat Users List" <us...@tomcat.apache.org>
>Subject: Re: Context and web.xml
>Date: Mon, 21 Aug 2006 16:29:04 -0400
>
>so if you to start off in context.xml with a path specification
><Context path="/urlPath ...>
>
>later on  in web.xml you have defined the servlet-mapping as
>     <servlet-mapping>
>         <servlet-name>urlPath</servlet-name>
>         <url-pattern>/servlet/urlPath</url-pattern>
>     </servlet-mapping>
>
>you would access the servlet with
>http://MachineName:Port/WebApp/servlet/UrlPath
>
>HTH,
>M-
>*********************************************************************
>This email message and any files transmitted with it contain confidential
>information intended only for the person(s) to whom this email message is
>addressed.  If you have received this email message in error, please notify
>the sender immediately by telephone or email and destroy the original
>message without making a copy.  Thank you.
>
>
>
>----- Original Message -----
>From: "MC Moisei" <mc...@hotmail.com>
>To: <us...@tomcat.apache.org>
>Sent: Monday, August 21, 2006 4:03 PM
>Subject: Re: Context and web.xml
>
>
> > Any tips on the matter ?
> >
> >>>From: Mark Thomas <ma...@apache.org>
> >>>Reply-To: "Tomcat Users List" <us...@tomcat.apache.org>
> >>>To: Tomcat Users List <us...@tomcat.apache.org>
> >>>Subject: Re: Context and web.xml
> >>>Date: Mon, 21 Aug 2006 07:27:32 -0400
> >>>
> >>>MC Moisei wrote:
> >>> > Hi,
> >>> >
> >>> > I'm using tomcat for dev. My question is for a dev environment. I 
>have
> >>> > context defined in conf %TOMCAT_HOME%\conf\Catalina\localhost. Is 
>there
> >>> > a way to specify what's the web.xml tomcat should use ? I use tomcat
> >>>for
> >>> > dev but I target Weblogic for production and such feature would be
> >>> > quite  useful.
> >>> >
> >>> > Thanks in advance,
> >>> > MC
> >>>
> >>>When starting a new thread (ie sending a message to the list about a
> >>>new topic) please do not reply to an existing message and change the
> >>>subject line. To many of the list archiving services and mail clients
> >>>used by list subscribers this  makes your new message appear as part
> >>>of the old thread. This makes it harder for other users to find
> >>>relevant information when searching the lists.
> >>>
> >>>This is known as thread hijacking and is behaviour that is frowned
> >>>upon on this list. Frequent offenders will be removed from the list.
> >>>It should also be noted that many list subscribers automatically
> >>>ignore any messages that hijack another thread.
> >>>
> >>>The correct procedure is to create a new message with a new subject.
> >>>This will start a new thread.
> >>>
> >>>Mark
> >>>tomcat-user-owner
> >
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Context and web.xml

Posted by Martin Gainty <mg...@hotmail.com>.
so if you to start off in context.xml with a path specification
<Context path="/urlPath ...>

later on  in web.xml you have defined the servlet-mapping as
    <servlet-mapping>
        <servlet-name>urlPath</servlet-name>
        <url-pattern>/servlet/urlPath</url-pattern>
    </servlet-mapping>

you would access the servlet with
http://MachineName:Port/WebApp/servlet/UrlPath

HTH,
M-
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "MC Moisei" <mc...@hotmail.com>
To: <us...@tomcat.apache.org>
Sent: Monday, August 21, 2006 4:03 PM
Subject: Re: Context and web.xml


> Any tips on the matter ?
> 
>>>From: Mark Thomas <ma...@apache.org>
>>>Reply-To: "Tomcat Users List" <us...@tomcat.apache.org>
>>>To: Tomcat Users List <us...@tomcat.apache.org>
>>>Subject: Re: Context and web.xml
>>>Date: Mon, 21 Aug 2006 07:27:32 -0400
>>>
>>>MC Moisei wrote:
>>> > Hi,
>>> >
>>> > I'm using tomcat for dev. My question is for a dev environment. I have
>>> > context defined in conf %TOMCAT_HOME%\conf\Catalina\localhost. Is there
>>> > a way to specify what's the web.xml tomcat should use ? I use tomcat 
>>>for
>>> > dev but I target Weblogic for production and such feature would be
>>> > quite  useful.
>>> >
>>> > Thanks in advance,
>>> > MC
>>>
>>>When starting a new thread (ie sending a message to the list about a
>>>new topic) please do not reply to an existing message and change the
>>>subject line. To many of the list archiving services and mail clients
>>>used by list subscribers this  makes your new message appear as part
>>>of the old thread. This makes it harder for other users to find
>>>relevant information when searching the lists.
>>>
>>>This is known as thread hijacking and is behaviour that is frowned
>>>upon on this list. Frequent offenders will be removed from the list.
>>>It should also be noted that many list subscribers automatically
>>>ignore any messages that hijack another thread.
>>>
>>>The correct procedure is to create a new message with a new subject.
>>>This will start a new thread.
>>>
>>>Mark
>>>tomcat-user-owner
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
>

Re: Context and web.xml

Posted by MC Moisei <mc...@hotmail.com>.
Any tips on the matter ?

>>From: Mark Thomas <ma...@apache.org>
>>Reply-To: "Tomcat Users List" <us...@tomcat.apache.org>
>>To: Tomcat Users List <us...@tomcat.apache.org>
>>Subject: Re: Context and web.xml
>>Date: Mon, 21 Aug 2006 07:27:32 -0400
>>
>>MC Moisei wrote:
>> > Hi,
>> >
>> > I'm using tomcat for dev. My question is for a dev environment. I have
>> > context defined in conf %TOMCAT_HOME%\conf\Catalina\localhost. Is there
>> > a way to specify what's the web.xml tomcat should use ? I use tomcat 
>>for
>> > dev but I target Weblogic for production and such feature would be
>> > quite  useful.
>> >
>> > Thanks in advance,
>> > MC
>>
>>When starting a new thread (ie sending a message to the list about a
>>new topic) please do not reply to an existing message and change the
>>subject line. To many of the list archiving services and mail clients
>>used by list subscribers this  makes your new message appear as part
>>of the old thread. This makes it harder for other users to find
>>relevant information when searching the lists.
>>
>>This is known as thread hijacking and is behaviour that is frowned
>>upon on this list. Frequent offenders will be removed from the list.
>>It should also be noted that many list subscribers automatically
>>ignore any messages that hijack another thread.
>>
>>The correct procedure is to create a new message with a new subject.
>>This will start a new thread.
>>
>>Mark
>>tomcat-user-owner



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Context and web.xml

Posted by MC Moisei <mc...@hotmail.com>.
My bad. Indeed, I did what you said but changed the topic. I thought that's 
the right email address.

Thanks for info Mark!
MC




>From: Mark Thomas <ma...@apache.org>
>Reply-To: "Tomcat Users List" <us...@tomcat.apache.org>
>To: Tomcat Users List <us...@tomcat.apache.org>
>Subject: Re: Context and web.xml
>Date: Mon, 21 Aug 2006 07:27:32 -0400
>
>MC Moisei wrote:
> > Hi,
> >
> > I'm using tomcat for dev. My question is for a dev environment. I have
> > context defined in conf %TOMCAT_HOME%\conf\Catalina\localhost. Is there
> > a way to specify what's the web.xml tomcat should use ? I use tomcat for
> > dev but I target Weblogic for production and such feature would be
> > quite  useful.
> >
> > Thanks in advance,
> > MC
>
>When starting a new thread (ie sending a message to the list about a
>new topic) please do not reply to an existing message and change the
>subject line. To many of the list archiving services and mail clients
>used by list subscribers this  makes your new message appear as part
>of the old thread. This makes it harder for other users to find
>relevant information when searching the lists.
>
>This is known as thread hijacking and is behaviour that is frowned
>upon on this list. Frequent offenders will be removed from the list.
>It should also be noted that many list subscribers automatically
>ignore any messages that hijack another thread.
>
>The correct procedure is to create a new message with a new subject.
>This will start a new thread.
>
>Mark
>tomcat-user-owner
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Context and web.xml

Posted by Mark Thomas <ma...@apache.org>.
MC Moisei wrote:
> Hi,
> 
> I'm using tomcat for dev. My question is for a dev environment. I have
> context defined in conf %TOMCAT_HOME%\conf\Catalina\localhost. Is there
> a way to specify what's the web.xml tomcat should use ? I use tomcat for
> dev but I target Weblogic for production and such feature would be
> quite  useful.
> 
> Thanks in advance,
> MC

When starting a new thread (ie sending a message to the list about a
new topic) please do not reply to an existing message and change the
subject line. To many of the list archiving services and mail clients
used by list subscribers this  makes your new message appear as part
of the old thread. This makes it harder for other users to find
relevant information when searching the lists.

This is known as thread hijacking and is behaviour that is frowned
upon on this list. Frequent offenders will be removed from the list.
It should also be noted that many list subscribers automatically
ignore any messages that hijack another thread.

The correct procedure is to create a new message with a new subject.
This will start a new thread.

Mark
tomcat-user-owner

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Context and web.xml

Posted by MC Moisei <mc...@hotmail.com>.
Hi,

I'm using tomcat for dev. My question is for a dev environment. I have 
context defined in conf %TOMCAT_HOME%\conf\Catalina\localhost. Is there a 
way to specify what's the web.xml tomcat should use ? I use tomcat for dev 
but I target Weblogic for production and such feature would be quite  
useful.

Thanks in advance,
MC



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JkMount and Context path

Posted by Evan J <ma...@gmail.com>.
Uhh! Ok, that's what I wanted to hear and it is evident that Context's
path is being ignored but why HTTP 400? Anyway, I do not believe the
"name" of context file has any bearing on the URI that must be
specified.

http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html says,

"If a Context Descriptor is not provided for a Context, Tomcat
automatically creates one and places it in (1) with a filename of
[webappname].xml although if manually created, the ___filename need
not match the web application name___ as Tomcat is concerned only with
the Context configuration contained within the Context Descriptor
file(s)."

And that holds true if I change conf/enginename/vh.host.com/myapp.xml
to yourapp.xml. After restarting Tomcat, it still requires me to
specify myapp/ for the URI, so it comes down to the name of the
directory (appBase + docBase) where the web application is being
deployed, in this case "myapp". Anyway, thank you for verifying that.

Sincerely,

Evan


On 8/20/06, Mark Thomas <ma...@apache.org> wrote:
> Evan J wrote:
> > conf/enginename/vh.host.com/myapp.xml:
> >
> > <Context path="someuri"
> >               docBase="/myapp"...>
>
> Ahh. Light dawns. It wasn't clear (to me at least) that you were using
> a context.xml file. I had assumed you were specifying the context
> inside server.xml. Using the configuration above the path will be
> ignored and the name of the context.xml file used instead as per
> http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
>
> Which changes my last post to:
> http://vh.host.com/myapp/eservlets/myservlet
>
> If you name the file ROOT.xml the the URL becomes:
> http://vh.host.com/eservlets/myservlet
>
> HTH,
>
> Mark
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JkMount and Context path

Posted by Mark Thomas <ma...@apache.org>.
Evan J wrote:
> conf/enginename/vh.host.com/myapp.xml:
> 
> <Context path="someuri"
>               docBase="/myapp"...>

Ahh. Light dawns. It wasn't clear (to me at least) that you were using
a context.xml file. I had assumed you were specifying the context
inside server.xml. Using the configuration above the path will be
ignored and the name of the context.xml file used instead as per
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

Which changes my last post to:
http://vh.host.com/myapp/eservlets/myservlet

If you name the file ROOT.xml the the URL becomes:
http://vh.host.com/eservlets/myservlet

HTH,

Mark


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JkMount and Context path

Posted by Evan J <ma...@gmail.com>.
Ok, that's what I had expected,
http://vh.host.com/someuri/eservlets/myservlet, but in reality, such
URL would produce HTTP 400 which has been puzzling me and I had
assumed I had some misunderstanding of something. But the weird thing
is http://vh.host.com/myapp/eservlets/myservlet works flawlessly so
that's why I was asking whether specifying JkMount would have any
bearing on Context path which seems like it doesn't in this case.
Again, my configration is as following:

httpd.conf:

<virtualhost ...>
   ServerName vh.host.com
   DocumentRoot /path/to/www

   JkMount /* worker1
   JkMount /*.jsp worker1

</virtualhost>

conf/server.xml

<Host name="vh.host.com"
           appBase="/path/to/vh"...>


conf/enginename/vh.host.com/myapp.xml:

<Context path="someuri"
               docBase="/myapp"...>

Note DocumentRoot of Apache differs from appBase in case Apache
doesn't take over Tomcat's responsibilities of handling servlets and
JSP that has no idea how to handle.

Anyway, your verification has made me more bewildered. Not sure what I
want to hear at this point.



On 8/20/06, Mark Thomas <ma...@apache.org> wrote:
> Evan J wrote:
> > Yes, I understand that perfectly. What I am asking is what if we
> > include a web application Context path, that is <Context
> > path="someuri"...>. Of course, JkMount /*/eservlet/* would relay all
> > the request with mywebapp/eservlet/* from Apache to Tomcat -- I am
> > aware of that. Now if we set <Context path="someuri"...>, what is
> > going to happen to our URI?
>
> http://host:port/contextpath/servletmapping
>
> in your case
>
> http://vh.host.com/someuri/eservlets/myservlet
>
> Mark
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JkMount and Context path

Posted by Mark Thomas <ma...@apache.org>.
Evan J wrote:
> Yes, I understand that perfectly. What I am asking is what if we
> include a web application Context path, that is <Context
> path="someuri"...>. Of course, JkMount /*/eservlet/* would relay all
> the request with mywebapp/eservlet/* from Apache to Tomcat -- I am
> aware of that. Now if we set <Context path="someuri"...>, what is
> going to happen to our URI?

http://host:port/contextpath/servletmapping

in your case

http://vh.host.com/someuri/eservlets/myservlet

Mark


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JkMount and Context path

Posted by Evan J <ma...@gmail.com>.
Yes, I understand that perfectly. What I am asking is what if we
include a web application Context path, that is <Context
path="someuri"...>. Of course, JkMount /*/eservlet/* would relay all
the request with mywebapp/eservlet/* from Apache to Tomcat -- I am
aware of that. Now if we set <Context path="someuri"...>, what is
going to happen to our URI?

Here's an excerpt from Tomcat config document:

"The context path of this web application, which is matched against
the beginning of each request URI to select the appropriate web
application for processing. All of the context paths within a
particular Host must be unique. If you specify a context path of an
empty string (""), you are defining the default web application for
this Host, which will process all requests not assigned to other
Contexts. The value of this field must not be set except when
statically defining a Context in server.xml, as it will be infered
from the filenames used for either the .xml context file or the
docBase."

So when Apache webserver gets a request for a particular virtualhost,
jk_mod sees if the request must be handled by Tomcat (i.e. satisfies
/*/eservlet/*) or not. If it does, it relays it to the appropriate
host and depending on "path" which is defined above, finally the
request is handed to the appropriate context or web application
designated for that "Host" (based on that "path", again according to
the excerpt above).  Now, having specified the "path," how are we
going to access a servlet with such scenario? I gave a straightforward
example but you still didn't answer my question.

On 8/20/06, Martin Gainty <mg...@hotmail.com> wrote:
> Why are you mixing up Apache and Tomcat?
>
> If you are speaking of AJP 'context' term
>  if you look at the doc you will see
> JkMount [URL prefix] [Worker name]
> /*where URL prefix is the context*/
> JkMount /*/esrvlt/* worker1
> Send all requests of whateverWebApp/eservlet/WhateverFileName to worker1 so in essence
> http://<host>/*/eservlet/<anything>
> will be directed to Tomcat
>
> Assuming your workers.properties has this configuration
> #workers.properties
> worker.worker1.port=8009
> worker.worker1.host=localhost
> worker.worker1.type=ajp13
>
> /*Now all tomcat requests are redirected to localhost on port 8009*/
> /*Inside $TOMCAT_HOME/conf/server.xml you have a connector which will listen on port 8009*/
>    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
>       <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
>                port="8009" minProcessors="5" maxProcessors="75"
>                enableLookups="true" redirectPort="8443"
>                acceptCount="10" debug="0" connectionTimeout="0"
>                useURIValidationHack="false"
>                protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
>
> Martin --
> *********************************************************************
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
>
>
>
> ----- Original Message -----
> From: "Evan J " <ma...@gmail.com>
> To: "Tomcat Users List" <us...@tomcat.apache.org>; "Martin Gainty" <mg...@hotmail.com>
> Sent: Sunday, August 20, 2006 1:15 PM
> Subject: Re: JkMount and Context path
>
>
> > Martin,
> >
> > I have the documents and I'm aware the difinition of Context path and
> > from what you have posted, it says, "It is matched against the
> > requesting URI." Now, my question was having Context path set, what
> > would the appropriate URI in case that the system utilizes Apache and
> > jk_mod in which JkMount is used for the requests to be processes by
> > jk_mod and passed on to Tomcat? Allow me to restate my example, so you
> > will be able to answer my question through the example itself.
> >
> > JkMount /*/esrvlt/* worker1
> > JkMount /*/esrvlt/*.jsp worker1
> >
> > The web application is "myapp"
> > Context path is "/someuri"
> > One of the servlet mapping in web.xml is "/esrvlt/myservlet"
> >
> > Now given that, how should "myservlet" be accessed, that is the actual
> > URL must look like?
> >
> > http://vh.host.com/myapp/esrvlt/myservlet OR
> > http://vh.host.com/someuri/myapp/esrvlt/myservlet OR
> > Must it have a different set of configuration (jkMount, path, mapping)
> > in order to be accessed properly? Or Context path in such situation
> > has no bearing? Please answer through forementioned scenario.
> >
> > And as for using Apache webserver... I am just playing around with
> > different configuration in order to understand how they interact with
> > each other. For now, I have no need to utilize a third party web
> > server. Although, that being said, I can see usage for having a front
> > end web server to, for example, pass on the load balancing to it
> > rather than let Tomcat's handle it. And as you have posted, directives
> > such as JkAutoAlias/JkMount/JkUnMount would allow me to process those
> > files that can be statistically served such as .gif or .html and
> > dynamic content to be passed on and handled by Tomcat (or any other
> > web container).
> >
> > Sincerely,
> >
> > Evan
> >
> >
> > On 8/20/06, Martin Gainty <mg...@hotmail.com> wrote:
> >> <Context path="/urlPath" docBase="/com/packagename" ... >
> >> #path is the context path of the webapp which is matched against the requesting URI to choose appropriate webapp to process (all paths must be unique)
> >> #docBase maps the urlPath to physical docBase (which can either be absolute path or relative to webapps)
> >> #embedding context elements within server.xml has been replaced by encapsulating context.xml for each webapp #$CATALINA_HOME/webapps/WebApp/META-INF/context.xml
> >>
> >> #within context You also have the capability of passing in initialisation parameters via <Parameter in context.xml
> >> #or Environment settings via <Environment parameter
> >>
> >> #If you have JDBC resources You can also declare ResourceParams for jdbc connections via <ResourceParams
> >>
> >> #You can also declare global JNDI resource via <ResourceLink
> >>
> >> Doc available at
> >> http://tomcat.apache.org/tomcat-5.0-doc/config/context.html
> >>
> >> Mod-jk
> >> #mod_jk JkAutoAlias maps all web application context directories into Apache document space..you DONT want to do this if you want to give Tomcat
> >> #control of the folder as in the example illustrated here
> >> JkAutoAlias /export/home/web/host2/webapps
> >>
> >> JkMount /*.jsp ajp13
> >> JkMount /*/servlet/ ajp13
> >>
> >> #A single webapp mapped into Apache document space can be accomplished via Alias as in this example
> >>  Alias /examples /export/home/web/host1/webapps/examples
> >>  JkMount /*.jsp ajp13
> >>  JkMount /*/servlet/ ajp13
> >>
> >> All of this depends on how you are configuring your Context listener as in this example
> >> <Host name="localhost" debug="0" appbase="webapps" >
> >>       <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
> >>           append="true"  forwardAll="true"/ >
> >> />
> >> #where the most significant parameter forwardAll = "true" will direct apache to forward your context listener requests to tomcat
> >> #verify these settings by viewing mod-jk.conf
> >>
> >> The only question I have is why not let tomcat run standalone?
> >> M-
> >> *********************************************************************
> >> This email message and any files transmitted with it contain confidential
> >> information intended only for the person(s) to whom this email message is
> >> addressed.  If you have received this email message in error, please notify
> >> the sender immediately by telephone or email and destroy the original
> >> message without making a copy.  Thank you.
> >>
> >>
> >>
> >> ----- Original Message -----
> >> From: "Evan J " <ma...@gmail.com>
> >> To: "Tomcat Users List" <us...@tomcat.apache.org>; "Martin Gainty" <mg...@hotmail.com>
> >> Sent: Sunday, August 20, 2006 1:01 AM
> >> Subject: Re: JkMount and Context path
> >>
> >>
> >> > Ok, your answer just recaps everything that is needed to run
> >> > Apache-jk_mod-Tomcat but does not answer my question. What if in your
> >> > setting, you have set Context path, what would be the consequences?
> >> > How are the servlets then are accessed? Is it required to include
> >> > Context path in the uri ending to the servlet like the examples are
> >> > provided earlier? It seems like that is not the case so I am taking it
> >> > either Context path, if it's designated, has no bearing when it comes
> >> > to jk_mod or must be included in the uri in some other way.
> >> >
> >> > On 8/19/06, Martin Gainty <mg...@hotmail.com> wrote:
> >> >> /*httpd.conf
> >> >> JkMount maps all JSP (*.jsp) to ajp13
> >> >> */
> >> >> e.g.
> >> >> httpd.conf
> >> >> JkMount /*.jsp ajp13
> >> >>
> >> >> /*map ajp13 to your webapp docRoot /var/tomcat4/webapps/domain1
> >> >> <VirtualHost *>
> >> >>     ServerName domain1.com
> >> >>     ServerAlias www.domain1.com
> >> >>     DocumentRoot /var/tomcat4/webapps/domain1
> >> >>     JkMount /* ajp13
> >> >> </VirtualHost>
> >> >>
> >> >> /*server.xml maps known webapp docBase /var/tomcat4/webapps/domain to domain name(domain1) via this entry*/
> >> >> <Host name="domain1.com" debug="0" appBase="webapps" unpackWARs="true">
> >> >> <Alias>www.domain1.com</Alias>
> >> >> <Logger className="org.apache.catalina.logger.FileLogger"
> >> >> directory="logs" prefix="virtual_log1." suffix=".log" timestamp="true"/>
> >> >> <Context path="" docBase="/var/tomcat4/webapps/domain1" debug="0" reloadable="true"/>
> >> >> </Host>
> >> >>
> >> >> HTH
> >> >> M-
> >> >
> >> > ---------------------------------------------------------------------
> >> > To start a new topic, e-mail: users@tomcat.apache.org
> >> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> > For additional commands, e-mail: users-help@tomcat.apache.org
> >> >
> >> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JkMount and Context path

Posted by Martin Gainty <mg...@hotmail.com>.
Why are you mixing up Apache and Tomcat?

If you are speaking of AJP 'context' term 
 if you look at the doc you will see
JkMount [URL prefix] [Worker name]
/*where URL prefix is the context*/
JkMount /*/esrvlt/* worker1
Send all requests of whateverWebApp/eservlet/WhateverFileName to worker1 so in essence
http://<host>/*/eservlet/<anything>
will be directed to Tomcat

Assuming your workers.properties has this configuration
#workers.properties
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13

/*Now all tomcat requests are redirected to localhost on port 8009*/
/*Inside $TOMCAT_HOME/conf/server.xml you have a connector which will listen on port 8009*/
   <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
      <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8009" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0" connectionTimeout="0"
               useURIValidationHack="false"
               protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>

Martin --
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Evan J " <ma...@gmail.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>; "Martin Gainty" <mg...@hotmail.com>
Sent: Sunday, August 20, 2006 1:15 PM
Subject: Re: JkMount and Context path


> Martin,
> 
> I have the documents and I'm aware the difinition of Context path and
> from what you have posted, it says, "It is matched against the
> requesting URI." Now, my question was having Context path set, what
> would the appropriate URI in case that the system utilizes Apache and
> jk_mod in which JkMount is used for the requests to be processes by
> jk_mod and passed on to Tomcat? Allow me to restate my example, so you
> will be able to answer my question through the example itself.
> 
> JkMount /*/esrvlt/* worker1
> JkMount /*/esrvlt/*.jsp worker1
> 
> The web application is "myapp"
> Context path is "/someuri"
> One of the servlet mapping in web.xml is "/esrvlt/myservlet"
> 
> Now given that, how should "myservlet" be accessed, that is the actual
> URL must look like?
> 
> http://vh.host.com/myapp/esrvlt/myservlet OR
> http://vh.host.com/someuri/myapp/esrvlt/myservlet OR
> Must it have a different set of configuration (jkMount, path, mapping)
> in order to be accessed properly? Or Context path in such situation
> has no bearing? Please answer through forementioned scenario.
> 
> And as for using Apache webserver... I am just playing around with
> different configuration in order to understand how they interact with
> each other. For now, I have no need to utilize a third party web
> server. Although, that being said, I can see usage for having a front
> end web server to, for example, pass on the load balancing to it
> rather than let Tomcat's handle it. And as you have posted, directives
> such as JkAutoAlias/JkMount/JkUnMount would allow me to process those
> files that can be statistically served such as .gif or .html and
> dynamic content to be passed on and handled by Tomcat (or any other
> web container).
> 
> Sincerely,
> 
> Evan
> 
> 
> On 8/20/06, Martin Gainty <mg...@hotmail.com> wrote:
>> <Context path="/urlPath" docBase="/com/packagename" ... >
>> #path is the context path of the webapp which is matched against the requesting URI to choose appropriate webapp to process (all paths must be unique)
>> #docBase maps the urlPath to physical docBase (which can either be absolute path or relative to webapps)
>> #embedding context elements within server.xml has been replaced by encapsulating context.xml for each webapp #$CATALINA_HOME/webapps/WebApp/META-INF/context.xml
>>
>> #within context You also have the capability of passing in initialisation parameters via <Parameter in context.xml
>> #or Environment settings via <Environment parameter
>>
>> #If you have JDBC resources You can also declare ResourceParams for jdbc connections via <ResourceParams
>>
>> #You can also declare global JNDI resource via <ResourceLink
>>
>> Doc available at
>> http://tomcat.apache.org/tomcat-5.0-doc/config/context.html
>>
>> Mod-jk
>> #mod_jk JkAutoAlias maps all web application context directories into Apache document space..you DONT want to do this if you want to give Tomcat
>> #control of the folder as in the example illustrated here
>> JkAutoAlias /export/home/web/host2/webapps
>>
>> JkMount /*.jsp ajp13
>> JkMount /*/servlet/ ajp13
>>
>> #A single webapp mapped into Apache document space can be accomplished via Alias as in this example
>>  Alias /examples /export/home/web/host1/webapps/examples
>>  JkMount /*.jsp ajp13
>>  JkMount /*/servlet/ ajp13
>>
>> All of this depends on how you are configuring your Context listener as in this example
>> <Host name="localhost" debug="0" appbase="webapps" >
>>       <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
>>           append="true"  forwardAll="true"/ >
>> />
>> #where the most significant parameter forwardAll = "true" will direct apache to forward your context listener requests to tomcat
>> #verify these settings by viewing mod-jk.conf
>>
>> The only question I have is why not let tomcat run standalone?
>> M-
>> *********************************************************************
>> This email message and any files transmitted with it contain confidential
>> information intended only for the person(s) to whom this email message is
>> addressed.  If you have received this email message in error, please notify
>> the sender immediately by telephone or email and destroy the original
>> message without making a copy.  Thank you.
>>
>>
>>
>> ----- Original Message -----
>> From: "Evan J " <ma...@gmail.com>
>> To: "Tomcat Users List" <us...@tomcat.apache.org>; "Martin Gainty" <mg...@hotmail.com>
>> Sent: Sunday, August 20, 2006 1:01 AM
>> Subject: Re: JkMount and Context path
>>
>>
>> > Ok, your answer just recaps everything that is needed to run
>> > Apache-jk_mod-Tomcat but does not answer my question. What if in your
>> > setting, you have set Context path, what would be the consequences?
>> > How are the servlets then are accessed? Is it required to include
>> > Context path in the uri ending to the servlet like the examples are
>> > provided earlier? It seems like that is not the case so I am taking it
>> > either Context path, if it's designated, has no bearing when it comes
>> > to jk_mod or must be included in the uri in some other way.
>> >
>> > On 8/19/06, Martin Gainty <mg...@hotmail.com> wrote:
>> >> /*httpd.conf
>> >> JkMount maps all JSP (*.jsp) to ajp13
>> >> */
>> >> e.g.
>> >> httpd.conf
>> >> JkMount /*.jsp ajp13
>> >>
>> >> /*map ajp13 to your webapp docRoot /var/tomcat4/webapps/domain1
>> >> <VirtualHost *>
>> >>     ServerName domain1.com
>> >>     ServerAlias www.domain1.com
>> >>     DocumentRoot /var/tomcat4/webapps/domain1
>> >>     JkMount /* ajp13
>> >> </VirtualHost>
>> >>
>> >> /*server.xml maps known webapp docBase /var/tomcat4/webapps/domain to domain name(domain1) via this entry*/
>> >> <Host name="domain1.com" debug="0" appBase="webapps" unpackWARs="true">
>> >> <Alias>www.domain1.com</Alias>
>> >> <Logger className="org.apache.catalina.logger.FileLogger"
>> >> directory="logs" prefix="virtual_log1." suffix=".log" timestamp="true"/>
>> >> <Context path="" docBase="/var/tomcat4/webapps/domain1" debug="0" reloadable="true"/>
>> >> </Host>
>> >>
>> >> HTH
>> >> M-
>> >
>> > ---------------------------------------------------------------------
>> > To start a new topic, e-mail: users@tomcat.apache.org
>> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> > For additional commands, e-mail: users-help@tomcat.apache.org
>> >
>> >
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
>

Re: JkMount and Context path

Posted by Evan J <ma...@gmail.com>.
Martin,

I have the documents and I'm aware the difinition of Context path and
from what you have posted, it says, "It is matched against the
requesting URI." Now, my question was having Context path set, what
would the appropriate URI in case that the system utilizes Apache and
jk_mod in which JkMount is used for the requests to be processes by
jk_mod and passed on to Tomcat? Allow me to restate my example, so you
will be able to answer my question through the example itself.

JkMount /*/esrvlt/* worker1
JkMount /*/esrvlt/*.jsp worker1

The web application is "myapp"
Context path is "/someuri"
One of the servlet mapping in web.xml is "/esrvlt/myservlet"

Now given that, how should "myservlet" be accessed, that is the actual
URL must look like?

http://vh.host.com/myapp/esrvlt/myservlet OR
http://vh.host.com/someuri/myapp/esrvlt/myservlet OR
Must it have a different set of configuration (jkMount, path, mapping)
in order to be accessed properly? Or Context path in such situation
has no bearing? Please answer through forementioned scenario.

And as for using Apache webserver... I am just playing around with
different configuration in order to understand how they interact with
each other. For now, I have no need to utilize a third party web
server. Although, that being said, I can see usage for having a front
end web server to, for example, pass on the load balancing to it
rather than let Tomcat's handle it. And as you have posted, directives
such as JkAutoAlias/JkMount/JkUnMount would allow me to process those
files that can be statistically served such as .gif or .html and
dynamic content to be passed on and handled by Tomcat (or any other
web container).

Sincerely,

Evan


On 8/20/06, Martin Gainty <mg...@hotmail.com> wrote:
> <Context path="/urlPath" docBase="/com/packagename" ... >
> #path is the context path of the webapp which is matched against the requesting URI to choose appropriate webapp to process (all paths must be unique)
> #docBase maps the urlPath to physical docBase (which can either be absolute path or relative to webapps)
> #embedding context elements within server.xml has been replaced by encapsulating context.xml for each webapp #$CATALINA_HOME/webapps/WebApp/META-INF/context.xml
>
> #within context You also have the capability of passing in initialisation parameters via <Parameter in context.xml
> #or Environment settings via <Environment parameter
>
> #If you have JDBC resources You can also declare ResourceParams for jdbc connections via <ResourceParams
>
> #You can also declare global JNDI resource via <ResourceLink
>
> Doc available at
> http://tomcat.apache.org/tomcat-5.0-doc/config/context.html
>
> Mod-jk
> #mod_jk JkAutoAlias maps all web application context directories into Apache document space..you DONT want to do this if you want to give Tomcat
> #control of the folder as in the example illustrated here
> JkAutoAlias /export/home/web/host2/webapps
>
> JkMount /*.jsp ajp13
> JkMount /*/servlet/ ajp13
>
> #A single webapp mapped into Apache document space can be accomplished via Alias as in this example
>  Alias /examples /export/home/web/host1/webapps/examples
>  JkMount /*.jsp ajp13
>  JkMount /*/servlet/ ajp13
>
> All of this depends on how you are configuring your Context listener as in this example
> <Host name="localhost" debug="0" appbase="webapps" >
>       <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
>           append="true"  forwardAll="true"/ >
> />
> #where the most significant parameter forwardAll = "true" will direct apache to forward your context listener requests to tomcat
> #verify these settings by viewing mod-jk.conf
>
> The only question I have is why not let tomcat run standalone?
> M-
> *********************************************************************
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
>
>
>
> ----- Original Message -----
> From: "Evan J " <ma...@gmail.com>
> To: "Tomcat Users List" <us...@tomcat.apache.org>; "Martin Gainty" <mg...@hotmail.com>
> Sent: Sunday, August 20, 2006 1:01 AM
> Subject: Re: JkMount and Context path
>
>
> > Ok, your answer just recaps everything that is needed to run
> > Apache-jk_mod-Tomcat but does not answer my question. What if in your
> > setting, you have set Context path, what would be the consequences?
> > How are the servlets then are accessed? Is it required to include
> > Context path in the uri ending to the servlet like the examples are
> > provided earlier? It seems like that is not the case so I am taking it
> > either Context path, if it's designated, has no bearing when it comes
> > to jk_mod or must be included in the uri in some other way.
> >
> > On 8/19/06, Martin Gainty <mg...@hotmail.com> wrote:
> >> /*httpd.conf
> >> JkMount maps all JSP (*.jsp) to ajp13
> >> */
> >> e.g.
> >> httpd.conf
> >> JkMount /*.jsp ajp13
> >>
> >> /*map ajp13 to your webapp docRoot /var/tomcat4/webapps/domain1
> >> <VirtualHost *>
> >>     ServerName domain1.com
> >>     ServerAlias www.domain1.com
> >>     DocumentRoot /var/tomcat4/webapps/domain1
> >>     JkMount /* ajp13
> >> </VirtualHost>
> >>
> >> /*server.xml maps known webapp docBase /var/tomcat4/webapps/domain to domain name(domain1) via this entry*/
> >> <Host name="domain1.com" debug="0" appBase="webapps" unpackWARs="true">
> >> <Alias>www.domain1.com</Alias>
> >> <Logger className="org.apache.catalina.logger.FileLogger"
> >> directory="logs" prefix="virtual_log1." suffix=".log" timestamp="true"/>
> >> <Context path="" docBase="/var/tomcat4/webapps/domain1" debug="0" reloadable="true"/>
> >> </Host>
> >>
> >> HTH
> >> M-
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JkMount and Context path

Posted by Martin Gainty <mg...@hotmail.com>.
<Context path="/urlPath" docBase="/com/packagename" ... >
#path is the context path of the webapp which is matched against the requesting URI to choose appropriate webapp to process (all paths must be unique)
#docBase maps the urlPath to physical docBase (which can either be absolute path or relative to webapps)
#embedding context elements within server.xml has been replaced by encapsulating context.xml for each webapp #$CATALINA_HOME/webapps/WebApp/META-INF/context.xml

#within context You also have the capability of passing in initialisation parameters via <Parameter in context.xml
#or Environment settings via <Environment parameter

#If you have JDBC resources You can also declare ResourceParams for jdbc connections via <ResourceParams

#You can also declare global JNDI resource via <ResourceLink

Doc available at
http://tomcat.apache.org/tomcat-5.0-doc/config/context.html

Mod-jk
#mod_jk JkAutoAlias maps all web application context directories into Apache document space..you DONT want to do this if you want to give Tomcat
#control of the folder as in the example illustrated here
JkAutoAlias /export/home/web/host2/webapps
           
JkMount /*.jsp ajp13
JkMount /*/servlet/ ajp13
           
#A single webapp mapped into Apache document space can be accomplished via Alias as in this example
 Alias /examples /export/home/web/host1/webapps/examples
 JkMount /*.jsp ajp13
 JkMount /*/servlet/ ajp13

All of this depends on how you are configuring your Context listener as in this example
<Host name="localhost" debug="0" appbase="webapps" >
      <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" 
          append="true"  forwardAll="true"/ >
/>
#where the most significant parameter forwardAll = "true" will direct apache to forward your context listener requests to tomcat
#verify these settings by viewing mod-jk.conf

The only question I have is why not let tomcat run standalone?
M-
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Evan J " <ma...@gmail.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>; "Martin Gainty" <mg...@hotmail.com>
Sent: Sunday, August 20, 2006 1:01 AM
Subject: Re: JkMount and Context path


> Ok, your answer just recaps everything that is needed to run
> Apache-jk_mod-Tomcat but does not answer my question. What if in your
> setting, you have set Context path, what would be the consequences?
> How are the servlets then are accessed? Is it required to include
> Context path in the uri ending to the servlet like the examples are
> provided earlier? It seems like that is not the case so I am taking it
> either Context path, if it's designated, has no bearing when it comes
> to jk_mod or must be included in the uri in some other way.
> 
> On 8/19/06, Martin Gainty <mg...@hotmail.com> wrote:
>> /*httpd.conf
>> JkMount maps all JSP (*.jsp) to ajp13
>> */
>> e.g.
>> httpd.conf
>> JkMount /*.jsp ajp13
>>
>> /*map ajp13 to your webapp docRoot /var/tomcat4/webapps/domain1
>> <VirtualHost *>
>>     ServerName domain1.com
>>     ServerAlias www.domain1.com
>>     DocumentRoot /var/tomcat4/webapps/domain1
>>     JkMount /* ajp13
>> </VirtualHost>
>>
>> /*server.xml maps known webapp docBase /var/tomcat4/webapps/domain to domain name(domain1) via this entry*/
>> <Host name="domain1.com" debug="0" appBase="webapps" unpackWARs="true">
>> <Alias>www.domain1.com</Alias>
>> <Logger className="org.apache.catalina.logger.FileLogger"
>> directory="logs" prefix="virtual_log1." suffix=".log" timestamp="true"/>
>> <Context path="" docBase="/var/tomcat4/webapps/domain1" debug="0" reloadable="true"/>
>> </Host>
>>
>> HTH
>> M-
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
>

Re: JkMount and Context path

Posted by Evan J <ma...@gmail.com>.
Ok, your answer just recaps everything that is needed to run
Apache-jk_mod-Tomcat but does not answer my question. What if in your
setting, you have set Context path, what would be the consequences?
How are the servlets then are accessed? Is it required to include
Context path in the uri ending to the servlet like the examples are
provided earlier? It seems like that is not the case so I am taking it
either Context path, if it's designated, has no bearing when it comes
to jk_mod or must be included in the uri in some other way.

On 8/19/06, Martin Gainty <mg...@hotmail.com> wrote:
> /*httpd.conf
> JkMount maps all JSP (*.jsp) to ajp13
> */
> e.g.
> httpd.conf
> JkMount /*.jsp ajp13
>
> /*map ajp13 to your webapp docRoot /var/tomcat4/webapps/domain1
> <VirtualHost *>
>     ServerName domain1.com
>     ServerAlias www.domain1.com
>     DocumentRoot /var/tomcat4/webapps/domain1
>     JkMount /* ajp13
> </VirtualHost>
>
> /*server.xml maps known webapp docBase /var/tomcat4/webapps/domain to domain name(domain1) via this entry*/
> <Host name="domain1.com" debug="0" appBase="webapps" unpackWARs="true">
> <Alias>www.domain1.com</Alias>
> <Logger className="org.apache.catalina.logger.FileLogger"
> directory="logs" prefix="virtual_log1." suffix=".log" timestamp="true"/>
> <Context path="" docBase="/var/tomcat4/webapps/domain1" debug="0" reloadable="true"/>
> </Host>
>
> HTH
> M-

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JkMount and Context path

Posted by Martin Gainty <mg...@hotmail.com>.
/*httpd.conf
JkMount maps all JSP (*.jsp) to ajp13 
*/
e.g.
httpd.conf
JkMount /*.jsp ajp13

/*map ajp13 to your webapp docRoot /var/tomcat4/webapps/domain1
<VirtualHost *>
    ServerName domain1.com
    ServerAlias www.domain1.com
    DocumentRoot /var/tomcat4/webapps/domain1
    JkMount /* ajp13
</VirtualHost>

/*server.xml maps known webapp docBase /var/tomcat4/webapps/domain to domain name(domain1) via this entry*/
<Host name="domain1.com" debug="0" appBase="webapps" unpackWARs="true">
<Alias>www.domain1.com</Alias>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="virtual_log1." suffix=".log" timestamp="true"/>
<Context path="" docBase="/var/tomcat4/webapps/domain1" debug="0" reloadable="true"/>
</Host>

HTH
M-
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.




> I've a question regarding the way jk_mod relays requests to Tomcat
> servlets. If I have set my virtualhost to supposedly send requests
> with such JkMount directive URL prefix, /serve/* and /serve/*.jsp,
> then I take it, the only way for jk_mod relays requests for this
> virtualhost to Tomcat web application listening on the other end is
> the actual web application "name" (or directory where it is located)
> to be "serve".
> 
> On other hand, if the JkMount directive is /*/eservlets/* (or
> /*/eservlets/*.jsp), then all the web applications that have a servlet
> /eservlets/* mapping are being granted such connection between
> Apache->jk_mod->Tomcat instance. So now, what if we change the web
> application's Context's path, that is <Context path="/someuri"...>,
> then how is the servlet with /eservlets/* mapping is going to be
> accessed?
> 
> Would it be http://vh.host.com/someuri/myapp/eservlets/myservlet or
> perhaps, http://vh.host.com/myapp/someuir/eservlets/myservlet
> (assuming the web application name is "myapp"? In any case, the former
> would produce HTTP 400 and the latter HTTP 404. So obviously Context
> path has no bearing in accessing the servlets, that is
> http://vh.host.com/myapp/eservlets/myservlet works just fine but
> inclusion of "someuri" would result in HTTP 400. So what is going on?
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
>