# Put webMathematica folder outside Tomcat webapps folder?

Is it possible to put the webMathematica folder outside the usual Tomcat webapps folder and still have webMathematica work?

webMathematica does work OK if its whole folder is placed inside Tomcat's webapps — and accessed in the browser as localhost:8080/webMathematica.

(This is with Tomcat 9 under OS X 10.10.4 and using webMathematica 3.3.2 calling Mathematica 10.2.)

Configuration details would be greatly appreciated!

In asking this I have four aims:

1. Granularize things so that I can just back up the webMathematica folder, along with other documents of mine, separately from backing up Tomcat's own files such as those in its distributed webapps folder.

2. Be able to access webMathematica (and, eventually, some specific apps using it) on localhost by means of a simple URL "alias", such as webmathematica, rather than the usual complete URL localhost:8080/webMathematica — just as I can now access Tomcat's webapps by entering the URL tomcat.local.

3. [added] Still allow use of Tomcat for webapps other than webMathematica. Thus changing the entire Tomcat docBase value — if that actually worked — would not allow achieving this aim.

4. [added] Be able to run webMathematica in my browser by entering a simple URL such as webmathematica.local(without the fully-qualified URL localhost:8080/webMathematica).

• Did you try a symbolic link? – Rolf Mertig May 6 '13 at 21:00
• @Rolf Mertig: Yes, a symlink works, with URL http://localhost:8080/webMathematica! But what I'd actually like to do is use a simpler URL such as webmathematica.local, and for that obviously some kind of additional configuration of tomcat and/or apache is required. (In apache I'm passing calls to tomcat via ajp.) – murray May 6 '13 at 21:24
• For the URL part I think this and no.4 in this should get you started... – Albert Retey May 7 '13 at 6:12
• Alas, I don't comprehend how to put the "this" and "no. 4 in this" together for the situation I describe. Don't I need, also to add an entry such as 127.0.0.1 webmathematica.local to /etc/hosts and a corresponding VirtualHost entry to apache2/conf/extra/httpd-vhosts.conf? – murray Aug 14 '15 at 14:01

Yes, it's possible. So you don't have to type the webMathematica after your localhost address.
2. Create a file named ROOT.xml inside \Tomcat\conf\Catalina\localhost\
3. In this file, write: <Context docBase="C:\webMathematica" reloadable="false"/>
• No, that's not working (OS X 10.10.4) even if I keep the webmathematica folder in its default position /usr/local/apache-tomcat-7.0.37/webapps and use that location in the docBase value in the file  /usr/local/apache-tomcat-7.0.37/conf/Catalina/localhost/ROOT.xml` that you describe. After restarting Tomcat (and apache), browsing to localhost:8080 still brings up the default Tomcat page, not the webMathematica page. – murray Aug 13 '15 at 20:36