Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy web application other than webapp folder in apache tomcat

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.

like image 618
Parth Avatar asked Nov 19 '13 06:11

Parth


People also ask

How do I change the context path of a web application in Tomcat?

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 .

Can we deploy jar file in Tomcat?

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.

In which folder we will deploy the application in Tomcat server?

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.

Which is the basic deployment folder in web container of Tomcat?

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.


1 Answers

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/EngineHost[@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.

like image 93
René Link Avatar answered Oct 25 '22 11:10

René Link