I want to deploy web application in directory(e.g \Users\username\myapps\app1) other than webapps folder.
I know to how to change "appBase" other than webapps by setting "appBase" attribute in "host" tag in server.xml in conf directory.
But problem is, I don't want to change whole webapps directory, I just want to deploy one application not in webapps directory.
Create a folder named DemoWebsite under the root (i.e., / ) of the file system. The context path will be determined by the name of the file, not the path attribute value. The path attribute is only used by Tomcat if a context is placed in server. xml .
Tomcat JAR deployment options There are three recommended options to make this happen: Package the JAR file in the WEB-INF\lib folder of the Java web application; Place the JAR file in the \lib subfolder of the Apache Tomcat installation; Configure a folder for shared JAR files by editing Tomcat's common.
Perhaps the simplest way to deploy a WAR file to Tomcat is to copy the file to Tomcat's webapps directory. Copy and paste WAR files into Tomcat's webapps directory to deploy them. Tomcat monitors this webapps directory for changes, and if it finds a new file there, it will attempt to deploy it.
By default, the folder is myapp . path : Deployed context path of the web application, by default /myapp . url : Absolute URL to the Tomcat Manager web application of a running Tomcat server, which will be used to deploy and undeploy the web application.
Use a context.xml
file placed in the $CATALINA_BASE/conf/[enginename]/[hostname]/
directory.
enginename
-> server.xml
- Server/Service/
Engine[@name]
Default is Catalina
.hostname
-> server.xml
- Server/Service/Engine
Host[@name]
Default is localhost
.You can specify the absolute path or relative path in the docBase
attribute.
<Context docBase="/Users/username/myapps/app1">
</Context>
See http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
PS (from the tomcat doc):
It is NOT recommended to place elements directly in the server.xml file. This is because it makes modifying the Context configuration more invasive since the main
conf/server.xml
file cannot be reloaded without restarting Tomcat.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With