You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Taylor <64...@bellsouth.net> on 2006/02/23 14:29:17 UTC

context path ignored in Context.xml

Greetings,

I'm using Tomcat 5.5.15 on Win2k in development.
I start Tomcat through a target in my Ant build and pass it a server.xml 
file.

My web app is deployed to a directory named "webapp" (the docbase) and 
contains a /META-INF/context.xml file which has a context path, "/test".

When I start tomcat and attempt to access my web app using the context 
path of /test, I get a strange 400 error.


HTTP/1.x 400 No Host matches server name localhost




When I access the webapp using /webapp as the context path, tomcat 
serves up the content.

Therefore, it appears that Tomcat is ignoring the context path I have 
defined and using the docbase directory in name by default.

I have been pouring over the online docs for a couple days and haven't 
been able to figure this one out.

Any help would be appreciated.

/robert



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


Re: context path ignored in Context.xml

Posted by Robert Taylor <64...@bellsouth.net>.
Markus,

Thanks for replying. I saw that line as well:

"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."

As the current 5.5 documentation states that it is not recommended to
embed Contexts in server.xml but rather place them in /META-INF/ of the
web app, I was unclear as to the validity of the above statement for my 
particular case. That is, I don't staically define my Context in 
server.xml, but rather in the recommended location (META-INF).

Thanks for the clarification.

/robert


Markus Schönhaber wrote:
> Robert Taylor wrote:
> 
>>Greetings,
>>
>>I'm using Tomcat 5.5.15 on Win2k in development.
>>I start Tomcat through a target in my Ant build and pass it a server.xml
>>file.
>>
>>My web app is deployed to a directory named "webapp" (the docbase) and
>>contains a /META-INF/context.xml file which has a context path, "/test".
>>
>>When I start tomcat and attempt to access my web app using the context
>>path of /test, I get a strange 400 error.
>>
>>
>>HTTP/1.x 400 No Host matches server name localhost
>>
>>
>>
>>
>>When I access the webapp using /webapp as the context path, tomcat
>>serves up the content.
>>
>>Therefore, it appears that Tomcat is ignoring the context path I have
>>defined and using the docbase directory in name by default.
> 
> 
> And that's exactly the way it's documented. Read about <Context>'s 
> "path"-attribute here:
> http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
> 
> In essence: in most situations the "path"-attribute is ignored (even 
> documented as "must not be set") and the Context path is derived from the 
> corresponding filename.
> 
> Regards
>   mks
> 
> ---------------------------------------------------------------------
> 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: context path ignored in Context.xml

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Robert Taylor wrote:
> Greetings,
>
> I'm using Tomcat 5.5.15 on Win2k in development.
> I start Tomcat through a target in my Ant build and pass it a server.xml
> file.
>
> My web app is deployed to a directory named "webapp" (the docbase) and
> contains a /META-INF/context.xml file which has a context path, "/test".
>
> When I start tomcat and attempt to access my web app using the context
> path of /test, I get a strange 400 error.
>
>
> HTTP/1.x 400 No Host matches server name localhost
>
>
>
>
> When I access the webapp using /webapp as the context path, tomcat
> serves up the content.
>
> Therefore, it appears that Tomcat is ignoring the context path I have
> defined and using the docbase directory in name by default.

And that's exactly the way it's documented. Read about <Context>'s 
"path"-attribute here:
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

In essence: in most situations the "path"-attribute is ignored (even 
documented as "must not be set") and the Context path is derived from the 
corresponding filename.

Regards
  mks

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


Re: context path ignored in Context.xml

Posted by Sathish Sathyan <sa...@cognizant.com>.
Hi Robert,

To counter such a problem, try giving the absolute path in the 'appBase'
parameter of the HostName tag in server.xml.

My server.xml is something like this:
<Service name="Catalina">
    <Connector port="8080"
        maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
        enableLookups="true" redirectPort="8443"
        acceptCount="10" debug="0" connectionTimeout="20000"
        disableUploadTimeout="true" />

  <Engine name="Standalone" defaultHost="localhost" debug="0">
    <Realm  className="org.apache.catalina.realm.UserDatabaseRealm"
                  debug="0" resourceName="UserDatabase" />

   <Host name="localhost" appBase="/opt/oss/share/tomcat/base/webapps">
      </Host>
    </Engine>
  </Service>

After making these changes, the error didn't appear for me.

Thanks,
Sathish

On Thu, 2006-02-23 at 08:29 -0500, Robert Taylor wrote:
> Greetings,
> 
> I'm using Tomcat 5.5.15 on Win2k in development.
> I start Tomcat through a target in my Ant build and pass it a server.xml 
> file.
> 
> My web app is deployed to a directory named "webapp" (the docbase) and 
> contains a /META-INF/context.xml file which has a context path, "/test".
> 
> When I start tomcat and attempt to access my web app using the context 
> path of /test, I get a strange 400 error.
> 
> 
> HTTP/1.x 400 No Host matches server name localhost
> 
> 
> 
> 
> When I access the webapp using /webapp as the context path, tomcat 
> serves up the content.
> 
> Therefore, it appears that Tomcat is ignoring the context path I have 
> defined and using the docbase directory in name by default.
> 
> I have been pouring over the online docs for a couple days and haven't 
> been able to figure this one out.
> 
> Any help would be appreciated.
> 
> /robert
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. 
Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly 
prohibited and may be unlawful.

  Visit us at http://www.cognizant.com

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