You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Akoulov, Alexandre [IT]" <al...@citigroup.com> on 2005/11/24 07:08:53 UTC
TryNo2: "path" attribute for "Context" element in tomcat 5.5
Hi all,
I am just wondering if you have any comments on the following email:
-----Original Message-----
From: Akoulov, Alexandre [IT]
Sent: Wednesday, 23 November 2005 12:16 PM
To: Tomcat Users List
Subject: "path" attribute for "Context" element in tomcat 5.5
Hi all,
I am in the process of upgrading from tomcat-3.3 to tomcat-5.5.12.
One of the changes in tomcat 5.5 is the configuration of contexts (ie web apps) is now being done in individual files (with a ".xml" extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory ( rather than in $CATALINA_HOME/conf/server.xml, which is a tomcat-3.3 way).
To test this new configuration I've created the $CATALINA_HOME/conf/Catalina/localhost/test.xml with the following content:
-------------------------------------------------------------------------
<?xml version='1.0' encoding='utf-8'?>
<Context path="/testProjYY"
docBase="/home/alex/release/TestProj/war"
reloadable="true" crossContext="true" allowLinking="true" >
<Logger className="org.apache.catalina.logger.FileLogger"
directory="/home/alex/release/tomcat-5.5/logs"
prefix="localhost_log_TestProj." suffix=".txt"
timestamp="true"/>
</Context>
-------------------------------------------------------------------------
As you can see the 'path' attribute is '/testProjYY' and in order to access this app I tried to hit http://sydap42d.aus.nsroot.net:8080/testProjYY/TestServlet url and .... I got 404 (The requested resource (/testProjYY/TestServlet) is not available.) error.
So I went to Context element description (http://tomcat.apache.org/tomcat-5.5-doc/config/context.html) and found the following : "path... The context path of this web application...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." Last sentence indicates that the 'path' attribute value is ignored, unless Context element is defined in server.xml (which is not encouraged in tomcat-5.5), and .xml file name is used as a context path instead.
Therefore I've modified $CATALINA_HOME/conf/Catalina/localhost/test.xml (got rid of the 'path' tag):
-------------------------------------------------------------------------
<Context docBase="/home/alex/release/TestProj/war"
reloadable="true" crossContext="true" allowLinking="true" >
<Logger className="org.apache.catalina.logger.FileLogger"
directory="/home/alex/release/tomcat-5.5/logs"
prefix="localhost_log_TestProj." suffix=".txt"
timestamp="true"/>
</Context>
-------------------------------------------------------------------------
Then I hit http://sydap42d.aus.nsroot.net:8080/test/TestServlet (/test context path is derived from $CATALINA_HOME/conf/Catalina/localhost/test.xml filename) and got the html generated by TestServlet.
Is it a right way to configure a context ? It just seems a bit strange that the 'path' attribute is completely ignored and instead the filename is used as a context path.
Thanks a lot for your time and assistance on this matter.
Kind regards,
Alex.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: TryNo2: "path" attribute for "Context" element in tomcat 5.5
Posted by Hassan Schroeder <ha...@webtuitive.com>.
Akoulov, Alexandre [IT] wrote:
> I am just wondering if you have any comments on the following email:
> Is it a right way to configure a context ?
You configured it one way and it didn't work.
You configured it *per the documentation* and it *did* work.
What kind of comment would seem to be necessary? :-)
--
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org