File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Configure Tomcat 6 to serve applications in other than default directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Configure Tomcat 6 to serve applications in other than default directory" Watch "Configure Tomcat 6 to serve applications in other than default directory" New topic
Author

Configure Tomcat 6 to serve applications in other than default directory

shaikna lebbai
Greenhorn

Joined: Sep 04, 2007
Posts: 2
By default, Tomcat serves any application context stored under %TOMCAT_HOME%\webapps directory.

Besides, I want to keep a new application, say "test2", in other than default directory, i.e say in "d:\www\test2" directory.

I've tried different ways in both server.xml and context.xml, but in vain.
(There is no clear documentation or specific example in forum too)

Would you please guide me the required file changes with corresponding codes.
Thanks.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you create a context fragment file under tomcat/conf/Catalina/localhost that points to your web app, you can keep your web app anywhere you like.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

This exact same scenario was discussed here.
shaikna lebbai
Greenhorn

Joined: Sep 04, 2007
Posts: 2
Thanks!

I've created %CATALINA_HOME%\conf\catalina\localhost\test2.xml, and placed below contents:

<Context path="/test2" reloadable="true" docBase="d:\www\test2" debug="1"/>

and, restarted tomcat.

It worked perfectly!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Configure Tomcat 6 to serve applications in other than default directory