문제

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?

도움이 되었습니까?

해결책

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

다른 팁

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

<Context docBase="xyz/abc.war" path="/myapp" reloadable="true"/>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top