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. The Windows version of this library is provided in the "Connectors" folder, as mod_jaxcent20.DLL. For non-Windows systems, the C++ file mod_jaxcent.cpp needs to be compiled using the Apache include files and libraries, 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:

  LoadModule jaxcent_module modules/mod_jaxcent20.dll

Add a Location command:

  <Location /servlet/JaxcentServlet20>
  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.

JVM Full path to the Java JVM.DLL on your system. This should be somewhere under your Java installation "bin" directory. This parameter is required.
Classpath Classpath to use when starting up Java via the JVM DLL. The path must contain the following three files:
  • Jaxcent20.jar
  • JaxcentFramework20.jar
  • JaxcentConnector20.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.

This parameter is required.

LogFile 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.

This parameter is required.

JaxcentConfigXML 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 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 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.

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

When the module has been correctly configured, visit the URL http://localhost//servlet/JaxcentServlet20 (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 jaxcent20.js to the Apache root path (usually "htdocs").