You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Maik Brauer <ma...@brauer.nrw> on 2016/09/20 17:38:28 UTC

apache-tomcat-9.0.0.M10: Change Context-Path in META-INF/context.xml not working

I have a standard Tomcat9 installation. I just put a helloworld.war in the webapps folder and inside the META-INF I put the context.xml with a different path like: <Context path="/newcontext" />

But the context is still http://localhost/helloworld instead http://localhost/newcontext.

I tried so many things, but it is not possible to get Tomcat convinced to use the new path. Anybody who can help? Thanks.

RE: apache-tomcat-9.0.0.M10: Change Context-Path in META-INF/context.xml not working

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Maik Brauer [mailto:maik@brauer.nrw] 
> Subject: apache-tomcat-9.0.0.M10: Change Context-Path in META-INF/context.xml not working

> I have a standard Tomcat9 installation. I just put a helloworld.war in the webapps folder 
> and inside the META-INF I put the context.xml with a different path like: 
> <Context path="/newcontext" />

Which is not allowed.

> But the context is still http://localhost/helloworld instead http://localhost/newcontext.

As it should be.

> I tried so many things, but it is not possible to get Tomcat convinced to use the new path.

Correct.

> Anybody who can help?

Read the doc:
http://tomcat.apache.org/tomcat-9.0-doc/config/context.html

In particular, this sentence describing the path attribute:

"This attribute must only be used when statically defining a Context in server.xml. In all other circumstances, the path will be inferred from the filenames used for either the .xml context file or the docBase."

Rename your .war file if you want a different context name.  You may also place your webapp outside of the appBase directory, and place a [context_name].xml file in conf/Catalina/localhost with a docBase attribute pointing to the webapp location.

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


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