You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by mrpapini <pp...@viz4biz.com> on 2007/04/10 19:32:57 UTC
Multilevel context path problem
I have a problem deploying war file and specifying multilevel context path.
Similar question was asked in this forum before but without definitive
answer. My scenario is as follow, I have a war file, say webtest.war and I'd
like to access it by:
/test/webtest. I found the only way to do so is to actually create context
entry for this in server.xml inside host element.
Trying to create test#webtest.xml in conf/engine/host directory would not
work, tomcat would throw exception trying to access docBase test/webtest
(tomcat expands war file into webtest directory only). I've tried many
combinations and scenarios, nothing would work except having context inside
server.xml. However, that is bad because, 1. it seems to be deprecated, 2.
does not allow for dynamic reload. Anybody can share light on this? Is there
any combinations of settings/naming that would allow me to access webtest
app via /test/webtest context?
Regards,
-pp
--
View this message in context: http://www.nabble.com/Multilevel-context-path-problem-tf3554394.html#a9924480
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
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: Multilevel context path problem
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Ok... I'm not sure, it isnt intuitive, almost like context paths are a
useless extra, I cant say I understand it either.
If I want a servlet to say work on /test/secondlevel/
I change the name of the webapp to "test".... and I also change the context
path in conf /engine/location/ to "test" **even though it seems to do
nothing**
Then I map the secondary stuff in web.xml ie
<servlet-mapping>
<servlet-name>servlet name</servlet-name>
<url-pattern>/secondlevel/*</url-pattern>
</servlet-mapping>
Oh and if you want to address a JSP page as /test/secondlevel/
then you need to move the JSP page to a folder called secondlevel under the
Application called "test".
Thing is, if you ignore context paths and compare the urls to the physical
files and servlet mapping... its actually very intuitive WITHOUT context
paths, starts looking like a normal web site mapping.
Maybe that helps... its a good question, maybe a guru can tell us why it
behaves like this... it almost like context paths are a legacy thing that is
being phased out????
It seems to all depend on the name of the WAR file, and the folders under
webapps... for example look for the ROOT context path... its not in the
default tomcat setup... I think its all in the name of the file, and we must
just look at the folder and servlet mapping to see whats going to happen to
a URI.
Think they should just take it out.... what do they actually do?
BUT just to confuse the hell out of us...
If for example in netbeans... you make the context
/IgnoreAppname/ShowJspsHere/
and Run it IN the IDE.... it WILL use that context path.... AND it will
package it
with that context, and it will reflect in Tomcat conf/engine/location once
deployed.... BUT then tomcat ignores it and just uses the file name....
In netbeans I never touch the context path except in the case of making a
ROOT webapp.
And then its just the same as a web server... and that seems to work.
Dont know why but if I had to guess.... I think the context paths are
proving to be one mapping too many. If you think about servlet mapping,
virtual hosts, mod_jk mapping and all the rest of it... programming for
context paths must be a pain in the butt.
I think I can live without them... but I think they should either make them
work.... or take them out completely.
----- Original Message -----
From: "mrpapini" <pp...@viz4biz.com>
To: <us...@tomcat.apache.org>
Sent: Tuesday, April 10, 2007 7:32 PM
Subject: Multilevel context path problem
>
> I have a problem deploying war file and specifying multilevel context
> path.
> Similar question was asked in this forum before but without definitive
> answer. My scenario is as follow, I have a war file, say webtest.war and
> I'd
> like to access it by:
> /test/webtest. I found the only way to do so is to actually create context
> entry for this in server.xml inside host element.
> Trying to create test#webtest.xml in conf/engine/host directory would not
> work, tomcat would throw exception trying to access docBase test/webtest
> (tomcat expands war file into webtest directory only). I've tried many
> combinations and scenarios, nothing would work except having context
> inside
> server.xml. However, that is bad because, 1. it seems to be deprecated, 2.
> does not allow for dynamic reload. Anybody can share light on this? Is
> there
> any combinations of settings/naming that would allow me to access webtest
> app via /test/webtest context?
>
> Regards,
> -pp
>
> --
> View this message in context:
> http://www.nabble.com/Multilevel-context-path-problem-tf3554394.html#a9924480
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: Multilevel context path problem
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Ok... I'm not sure, it isnt intuitive, almost like context paths are a
useless extra, I cant say I understand it either.
If I want a servlet to say work on /test/secondlevel/
I change the name of the webapp to "test".... and I also change the context
path in conf /engine/location/ to "test" **even though it seems to do
nothing**
Then I map the secondary stuff in web.xml ie
<servlet-mapping>
<servlet-name>servlet name</servlet-name>
<url-pattern>/secondlevel/*</url-pattern>
</servlet-mapping>
Oh and if you want to address a JSP page as /test/secondlevel/
then you need to move the JSP page to a folder called secondlevel under the
Application called "test".
Thing is, if you ignore context paths and compare the urls to the physical
files and servlet mapping... its actually very intuitive WITHOUT context
paths, starts looking like a normal web site mapping.
Maybe that helps... its a good question, maybe a guru can tell us why it
behaves like this... it almost like context paths are a legacy thing that is
being phased out????
It seems to all depend on the name of the WAR file, and the folders under
webapps... for example look for the ROOT context path... its not in the
default tomcat setup... I think its all in the name of the file, and we must
just look at the folder and servlet mapping to see whats going to happen to
a URI.
Think they should just take it out.... what do they actually do?
BUT just to confuse the hell out of us...
If for example in netbeans... you make the context
/IgnoreAppname/ShowJspsHere/
and Run it IN the IDE.... it WILL use that context path.... AND it will
package it
with that context, and it will reflect in Tomcat conf/engine/location once
deployed.... BUT then tomcat ignores it and just uses the file name....
In netbeans I never touch the context path except in the case of making a
ROOT webapp.
And then its just the same as a web server... and that seems to work.
Dont know why but if I had to guess.... I think the context paths are
proving to be one mapping too many. If you think about servlet mapping,
virtual hosts, mod_jk mapping and all the rest of it... programming for
context paths must be a pain in the butt.
I think I can live without them... but I think they should either make them
work.... or take them out completely.
----- Original Message -----
From: "mrpapini" <pp...@viz4biz.com>
To: <us...@tomcat.apache.org>
Sent: Tuesday, April 10, 2007 7:32 PM
Subject: Multilevel context path problem
>
> I have a problem deploying war file and specifying multilevel context
> path.
> Similar question was asked in this forum before but without definitive
> answer. My scenario is as follow, I have a war file, say webtest.war and
> I'd
> like to access it by:
> /test/webtest. I found the only way to do so is to actually create context
> entry for this in server.xml inside host element.
> Trying to create test#webtest.xml in conf/engine/host directory would not
> work, tomcat would throw exception trying to access docBase test/webtest
> (tomcat expands war file into webtest directory only). I've tried many
> combinations and scenarios, nothing would work except having context
> inside
> server.xml. However, that is bad because, 1. it seems to be deprecated, 2.
> does not allow for dynamic reload. Anybody can share light on this? Is
> there
> any combinations of settings/naming that would allow me to access webtest
> app via /test/webtest context?
>
> Regards,
> -pp
---------------------------------------------------------------------
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: Multilevel context path problem
Posted by Rashmi Rubdi <ra...@gmail.com>.
I tried to create multi-level context paths for you according to the
documentation here:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
I tried something like this:
...\apache-tomcat-6.0.10\conf\Catalina\localhost\ROOT.xml
...\apache-tomcat-6.0.10\conf\Catalina\localhost\Second#Second.xml
Both of these files only had the Context node with path empty in both
and only the docBase was specified with reloadable set to true.
I got it working for a moment, that is I was able to access the
default context at
http://localhost:9090/ and the other context at
http://localhost:9090/Second/Second
But after that, I don't know what happened by none of the other
projects including the multilevel context project were available at
their respective URLs.
Tomcat usually shows a short snippet of INFO when it starts up, but
after adding the multilevel context I got some duplicate entries on
the console like this:
Apr 11, 2007 12:45:14 AM org.apache.catalina.startup.ContextConfig
defaultWebConfig
INFO: No default web.xml
The above like repeated about 6 times
This case happened twice, the 2nd time I tried it on a fresh install
of 6.0.10 --- but now I'm going to install TC fresh again.
Just thought I'll let you know (don't know if it helps).
-Rashmi
On 4/10/07, mrpapini <pp...@viz4biz.com> wrote:
>
> I have a problem deploying war file and specifying multilevel context path.
> Similar question was asked in this forum before but without definitive
> answer. My scenario is as follow, I have a war file, say webtest.war and I'd
> like to access it by:
> /test/webtest. I found the only way to do so is to actually create context
> entry for this in server.xml inside host element.
> Trying to create test#webtest.xml in conf/engine/host directory would not
> work, tomcat would throw exception trying to access docBase test/webtest
> (tomcat expands war file into webtest directory only). I've tried many
> combinations and scenarios, nothing would work except having context inside
> server.xml. However, that is bad because, 1. it seems to be deprecated, 2.
> does not allow for dynamic reload. Anybody can share light on this? Is there
> any combinations of settings/naming that would allow me to access webtest
> app via /test/webtest context?
>
> Regards,
> -pp
>
> --
> View this message in context: http://www.nabble.com/Multilevel-context-path-problem-tf3554394.html#a9924480
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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