Site Configuration

This section summarizes how to configure a webMathematica site. Most configuration information is held in the file MSPConfiguration.xml. The contents of this file are used to initialize the server and individual Mathematica kernels.

MSPConfiguration.xml

MSPConfiguration.xml is the central configuration file for webMathematica. A sample file is shown below.

<MSPConfiguration>
<KernelPool>
<KernelPoolName>General</KernelPoolName>
<KernelExecutable>D:\Mathematica\MathKernel.exe</KernelExecutable>
<KernelNumber>1</KernelNumber>
<URLPattern>/*</URLPattern>
</KernelPool>
</MSPConfiguration>

This shows the configuration for a kernel pool called General. A kernel pool is a group of Mathematica kernels that can be specially configured and is documented in the Advanced Topics: Multiple Kernel Pools section. You need to have at least one pool; webMathematica comes with a pool called General configured by default.

If you want to change some configuration information, for example, adding some code for the kernel to run when it is launched, you could add this to the configuration file. If you put it inside the KernelPool section, then the change will only apply to that pool. An example is shown below.

<MSPConfiguration>
<KernelPool>
...
<KernelInitializeCode>LoadPackage[]</KernelInitializeCode>
</KernelPool>
</MSPConfiguration>

However, if you want to make the change apply to any pool then you can put the code outside all the pools. This is shown in the following.

<MSPConfiguration>
<KernelInitializeCode>LoadPackage[]</KernelInitializeCode>
<KernelPool>
...
</KernelPool>
</MSPConfiguration>

If you are not sure what to do, then add the changes inside the pool definition.

The different configuration parameters are shown in the tables below.

KernelExecutablethe path to the kernel executable
KernelLaunchFlagsflags to use when the kernel is launched
KernelNumberthe number of kernels in a pool
KernelTimeLimitthe maximum time for each computation
KernelAcquireLimitthe number of requests a kernel can serve
KernelConnectLimitthe length of time for the kernel to wait to connect
KernelInitializeCodeMathematica code to run during kernel startup
KernelDestroyCodeMathematica code to run during kernel shutdown
KernelAcquireCodeMathematica code to run when a kernel is acquired
KernelReleaseCodeMathematica code to run when a kernel is released
KernelBaseMemoryLimitmemory limit for continuous usage
KernelPeakMemoryLimitmemory limit for temporary usage

Kernel configuration.

FrontEndExecutablethe path to the front end executable
FrontEndLaunchFlagsflags to use when the front end is launched
KeepFrontEndAlivewhether the front end should be kept running after usage

Front end configuration.

KernelPoolconfiguration section for a particular kernel pool
KernelPoolNamethe name of a kernel pool
URLPatternthe pattern to map URLs to a kernel pool

Kernel pool configuration.

SecurityConfigurationFilethe name of the security configuration file ToExpression
CheckToExpressionwhether a security check should be applied to ToExpression
CollectStreamswhether streams opened during a request should be automatically closed
FileUploadSizeLimitthe limit on the size of files that can be uploaded
JLinkNativeLibraryDirectorythe location of the J/Link native library

General site configuration.

Logging System

The logging system for webMathematica can be customized. This is described in the Logging section.

Security Configuration

The security system for webMathematica can be customized. This is described in the Security section.

X Server Configuration

Special configuration is often required to allow the front end to connect an X server. This is described in the Installation section under Configuring for the X Window System (Unix only). This is only an issue for running webMathematica under Unix.