Question

If it is possible, how do I deploy a war file from another directory (say D:\foo.war) to Tomcat 6, without copying it into the webapps directory of Tomcat?

If not, is there any configuration to change the default webapp folder to some other folder?

Was it helpful?

Solution

You can do both.

how do I deploy a war file from another directory (say D:\foo.war) to Tomcat 6, without copying it into the webapps directory of Tomcat?

Add a Context xml file to conf/Catalina/localhost. The name of the file should be the name that you want for the context. For example, if my URL is http://your.domain.com/my-context then the name of the file would be my-context.xml. Inside that XML file add something like this.

<?xml version="1.0"?>
<Context docBase="d:\foo.war">
</Context>

The docBase attribute should point to your WAR file or an exploded WAR directory. See more on this here.

If not, is there any configuration to change the default webapp folder to some other folder?

In conf/server.xml locate your Host tag and set the appBase attribute. This defaults to webapps, but you can change it to any location that you like.

Ex:

<Host appBase="d:\my-web-apps" ...>

For best results, point to local storage and not network storage (i.e. NFS or Samba).

OTHER TIPS

Simply specify a context entry in your server.xml (under <Host> </Host>

<Context docBase="xyz/abc.war" path="/myapp" reloadable="true"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top