setting up a virtual directory in Tomcat 4.1

daluu used Ask the Experts™
I've got Tomcat 4.1 setup on a server, with default settings (ie port 8080, web root = Tomcat default, etc.)

How can I setup a virtual directory in Tomcat so that the URL
http://serverurl/testdir refers to c:\inetpub\wwwroot\testdir (where testdir is NOT a virtual dir on IIS but happens to be a dir in wwwroot)

I tried adding this line in server.xml, right below Tomcat Root context and above Examples context:
<Context path="/team5" docBase="../../Inetpub/wwwroot/team5" debug="0" reloadable="true"/>
also tried referencing dobBase as C:\inetpub\wwwroot\team5 and C:\\inetpub\\wwwroot\\team5 but all three didn't work. Root dir is C:\Tomcat 4.1\webapps\ROOT

Everytime, restarting, I get 404 when testing the virtual directory. other than that tomcat runs ok.

I had originally wanted to setup Tomcat with IIS, but that didn't work on Win 2003, but here I can't even get Tomcat to use virtual directories (on Win 2003)

Am I missing something here?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


in case forgot to mention serverurl means serverurl:8080

You need to refer to it as:



it still doesn't work.

in my opinion, it seems to only recognize directories within the webapps folder. Too bad I can't use a Windows shortcut equivalent to Unix's symbolic link as a virtual directory work around.

any other ideas what I can do about this?


Well, I got lucky!  I found a workaround using a Window's version of symbolic links that could "fool" Tomcat to think the link was an actual directory within the webapps directory, from here:

thanks for the help heskyttberg,

but before finalizing the question, I would like to know what's the issue with Tomcat not recognizing virtual directories on my system. anybody have a clue?
does tomcat 4.1 have virtual directories at all?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial