Configuring Jaxcent servlet with the Apache Web Server

Jaxcent can be configured to work directly with the Apache Web Server via the mod-jaxcent extension module library. Versions of this library are provided in the "Connectors" folder, as mod_jaxcent21.DLL for 32-bit Windows, and as mod_jaxcent.so for 32-bit/64-bit Linux systems. For other systems, the C++ file mod_jaxcent.cpp needs to be compiled using the Apache JDK include files, to build the library.

To use this module, place the library file in the "modules" directory in the Apache hierarchy. Then configure the httpd.conf configuration file as follows.

Add a LoadModule command, e.g.

  LoadModule jaxcent_module modules/mod_jaxcent21.dll
or
  LoadModule jaxcent_module modules/mod_jaxcent.so

Add a Location command:

  <Location /servlet/JaxcentServlet21>
  SetHandler jaxcent-handler
  </Location>

Specify the Jaxcent initialization parameters in an IfModule block, as shown.

  <IfModule jaxcent_module>
    Parameters...
  </IfModule jaxcent_module>

Each parameter line consists of a parameter key name, followed by a space and the value of the parameter. The following are the parameter names.

ParameterVirtualizableRequiredDescription
JVM NoYes Full path to the Java JVM dynamic library (e.g. "JVM.DLL" or "libjvm.so") on your system. This should be somewhere under your Java installation directory. (Usually found under Java's "bin/client" and/or "bin/server" on Windows. If both "client" and "server" versions are available, the "server" version is recommended.)
Classpath NoYes Classpath to use when starting up Java. The path must contain the following two files:
  • Jaxcent21.jar
  • JaxcentFramework21.jar
In addition, it can contain other directories or jar files that you need. You can include your Jaxcent classes that are stable, here. Note that any classes you include here, will not be reloaded if it changes. The classes will be only reloaded when the Apache Web Server is stopped and restarted, and the next time the Jaxcent module is accessed again.
LogFile NoYes Full path to a log file where output from your Java classes will go. Any output you send to "System.out" as well as any exception stack traces will appear here.
JaxcentConfigXML YesYes Path to a config XML file, which will contain the path mappings for Jaxcent. Similar to the servlet mappings, Jaxcent maps URLs to Java classes that it then loads, to process those URLs. This parameter is required.
ReloadableClasses YesNo Classpath for Jaxcent. The classes you write for Jaxcent, will be loaded from this classpath. You can also provide these classes to the application server, but during development it is recommended that you give the classes to Jaxcent directly. Jaxcent will reload these classes whenever they change. If you reload them using the application server, the context may get reloaded, which will break any existing Jaxcent connections. If Jaxcent does the reloading, existing web pages will continue using the old code, but when the page gets loaded again or refreshed, the new code will be used. This paramter is not required, but is recommended.
Parameter YesNo You can provide other parameters for use by your own application, using the key Parameter followed by a line containing the key of your parameter, an equal sign, and the value of your parameter. These will simply be passed on to your application.

The virtualizable parameters can be specified multiple times, for any virtual hosts supported on the Apache server. However, they will all share the same JVM because multiple JVMs are not supported in a process. Therefore the LogFile, JVM and JVM parameters are not virtualizable, and can be specified only once.

A sample portion of httpd.conf file is shown below.

When the module has been correctly configured, visit the URL http://localhost//servlet/JaxcentServlet21 (changing the domain as appropriate) in a browser, to make sure the module is working as expected.

You will also need to copy the file jaxcent21.js to the Apache root path (usually "htdocs").