WEBMATHEMATICA TUTORIAL

Installing the webMathematica Web Application

This section describes how to install webMathematica components into your servlet container. For most servlet containers, this involves deploying the webMathematica web application found in archived form on the webMathematica Tools CD-ROM or from your download. Separate installation instructions are given for some different servlet containers. A web application is a collection of HTML and other web components, which are placed in a specific directory structure. Any servlet container that supports web applications will be able to use these files in a standard way. Web applications support a special type of archive called a WAR archive, which is supported by some servlet containers. webMathematica provides a WAR archive of the webMathematica archive.

Tomcat

This section describes the deployment of the webMathematica webapp in Tomcat. There are two steps: unpacking the webMathematica archive and configuring the MSPConfiguration.xml file.

First, choose one of the webMathematica archives from the Tools CD-ROM; for example, webMathematica.zip or webMathematica.war. Unpack the archive into the webMathematica directory located in the Tomcat webapps directory. This is usually found in the top-level directory of Tomcat. You have now created a web application called webMathematica. Some of the contents of the top directory of Tomcat, along with the location of the webapps directory and webMathematica web application, are shown below.

tomcat
conf
bin
logs
lib
webapps
webMathematica

Second, configure the file MSPConfiguration.xml, located in the WEB-INF directory. This file holds various site-specific parameters and may need modification for your site. The settings that can be placed into MSPConfiguration.xml are described in the section Site Configuration.

The most important setting is KernelExecutable, the location of the Mathematica kernel. The MSPConfiguration.xml that ships with webMathematica contains settings suitable for a default installation of Mathematica for Windows, Unix, Linux, and Mac OS X. However, if you install Mathematica into a nondefault location, you will need to modify this file. For example, if you installed Mathematica into E:\Mathematica, make the following setting of KernelExecutable in MSPConfiguration.xml.

<KernelExecutable>
E:\Mathematica\MathKernel.exe
</KernelExecutable>

Another reason to modify MSPConfiguration.xml is to store your webMathematica license in its own password file, for example, webMathematica/WEB-INF/conf/mathpass. It would then be necessary to modify KernelLaunchFlags in MSPConfiguration.xml to ensure that Mathematica uses this location. The following shows how this could be done for a typical Windows installation.

<KernelLaunchFlags>
-pwfile c:/Program Files/tomcat/webapps/webMathematica/WEB-INF/conf/mathpass
</KernelLaunchFlags>

A typical setting for MSPConfiguration.xml to use a special mathpass file under Unix is shown below.

<KernelLaunchFlags>
-pwfile /usr/local/tomcat/webapps/webMathematica/WEF-INF/conf/mathpass
</KernelLaunchFlags>

Under Unix, you may need to add a FrontEndLaunchFlags parameter so the front end can run properly. In the following example, the front end will be launched to use DISPLAY 1 with fixed geometry and in server mode. For more information on running the front end under Unix, see the documentation section Configuring for the X Window System.

<FrontEndLaunchFlags>
-display :1 -nogui -geometry 1000x500+10+10
</FrontEndLaunchFlags>

Other Servlet Engines

If you are unfamiliar with servlets, then it is recommended that you use Apache Tomcat. You should only use another servlet engine if you are already experienced with it.

If you have some other servlet engine, follow its instructions for installing a web application, which may be supported by some special tools. After installing the web application, you will need to modify the MSPConfiguration.xml file as described in the section on installing under Tomcat. It may also be necessary to make various modifications to MSPConfiguration.xml, such as changing the JLinkNativeLibraryDirectory setting.