Discussion:
context path ignored in conf/Catalina/localhost/*
D C
2013-08-29 18:02:36 UTC
Permalink
Tomcat 7.0.40
RHEL 6

I am trying to define all of my contexts in conf/Catalina/localhost/*.xml.

This seems to work fine, however I'm having an issue setting the path.

myApp.xml
<Context path="/tracking" >

This simply does not work. It worked fine if I put it into
conf/context.xml.

The only way this works is if i rename my war file to tracking.war.


Why is the path ignored?








Thanks,
Dan
Caldarale, Charles R
2013-08-29 18:09:09 UTC
Permalink
Subject: context path ignored in conf/Catalina/localhost/*
Tomcat 7.0.40
I am trying to define all of my contexts in conf/Catalina/localhost/*.xml.
This seems to work fine, however I'm having an issue setting the path.
myApp.xml
<Context path="/tracking" >
This simply does not work.
Nor should it.
The only way this works is if i rename my war file to tracking.war.
Which is exactly what you should do.
Why is the path ignored?
It's been illegal to put the path attribute in a <Context> element since at least 5.5. Read the doc:

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Daniel Mikusa
2013-08-29 18:10:00 UTC
Permalink
Post by D C
Tomcat 7.0.40
RHEL 6
I am trying to define all of my contexts in conf/Catalina/localhost/*.xml.
This seems to work fine, however I'm having an issue setting the path.
myApp.xml
<Context path="/tracking" >
This simply does not work.
You generally don't want to set "path". In most cases, path is inferred by the name of your deployment file, either <path>.war or <path>.xml.
Post by D C
It worked fine if I put it into conf/context.xml.
Yikes. I wouldn't suggest that.
Post by D C
The only way this works is if i rename my war file to tracking.war.
That's what you want to do.
Post by D C
Why is the path ignored?
In this case, it's by design. See the docs for more info. Check out the "path" attribute, the "Naming" and "Defining a context" sections.

https://tomcat.apache.org/tomcat-7.0-doc/config/context.html

Dan
Post by D C
Thanks,
Dan
D C
2013-08-29 19:47:03 UTC
Permalink
Post by D C
Post by D C
Tomcat 7.0.40
RHEL 6
I am trying to define all of my contexts in
conf/Catalina/localhost/*.xml.
Post by D C
This seems to work fine, however I'm having an issue setting the path.
myApp.xml
<Context path="/tracking" >
This simply does not work.
You generally don't want to set "path". In most cases, path is inferred
by the name of your deployment file, either <path>.war or <path>.xml.
Post by D C
It worked fine if I put it into conf/context.xml.
Yikes. I wouldn't suggest that.
Post by D C
The only way this works is if i rename my war file to tracking.war.
That's what you want to do.
Post by D C
Why is the path ignored?
In this case, it's by design. See the docs for more info. Check out the
"path" attribute, the "Naming" and "Defining a context" sections.
https://tomcat.apache.org/tomcat-7.0-doc/config/context.html
Dan
Post by D C
Thanks,
Dan
---------------------------------------------------------------------
​Thank you both. I see in the link you sent me, that "path" can only be
see from within server.xml.
To correct myself from eariler i said it worked in context.xml, when it
was in deed server.xml where i had it specified.


I would prefer not to to have to rename the war, but at this point im not
going to complain about it. :)

I just spent a lot of time migrating from server.xml to
conf/Catalina/localhost/*.xml. I'll have to deal with a rename to make
things work properly.




​


Thanks,
Dan
Christopher Schultz
2013-09-03 21:44:50 UTC
Permalink
Dan,
​Thank you both. I see in the link you sent me, that "path" can
only be see from within server.xml. To correct myself from eariler
i said it worked in context.xml, when it was in deed server.xml
where i had it specified.
I would prefer not to to have to rename the war, but at this point
im not going to complain about it. :)
I just spent a lot of time migrating from server.xml to
conf/Catalina/localhost/*.xml. I'll have to deal with a rename to
make things work properly.
If you don't want to re-name the WAR file (I really don't know why so
many people resist this), you can put the WAR file outside of your
Host's appBase and then use conf/Catalina/localhost/[appname].xml with
a docBase pointing to the WAR on the disk. In this case, the name of
the XML file identifies the context path and you can call the WAR file
anything you want.

- -chris

Loading...