This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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!
 
Don't get me started about those stupid light bulbs.
 
subject: Configure Tomcat 6 to serve applications in other than default directory
 
Similar Threads
Setting docbase for a web-application in JBoss 3.0.4 - Tomcat 4.1.12
Access a resource in different context
Setting docbase for a web-application in JBoss 3.0.4 - Tomcat 4.1.12
Absolute path for tomcat
Multiple instances of Tomcat 6, class loading experiencing problems for each instance