WebObjects 4: Public and Private WebObjects.conf Files

This article discusses the interaction between the public and private WebObjects.conf files in WebObjects 4.0.
About the WebObjects.conf Files


WebObjects.conf is a file that tells your WebObjects adaptor where to find application instances. A standard WebObjects deployment contains two WebObjects.conf files.


The Public WebObjects.conf file


The public WebObjects.conf file is created by the user, either manually with a text editor or through Monitor. It contains a one-line entry for every instance of every application that is running. For example, if you had three instances of HelloWorld running, the file would look something like this:

HelloWorld:1@lothrup 2001
HelloWorld:2@lothrup 2002
HelloWorld:3@lothrup 2003


The format for each entry is:

Application_Name:Instance_Number@Application_Server_Name Port_Number

The instance numbers are unique to each application. Monitor will write an entry to this file only after it has successfully started an instance.


The Private WebObjects.conf File


The private WebObjects.conf file is created by a WebObjects application. The private file looks a lot like the public file:

Monitor:-1@localhost 5000
HelloWorld:-1@localhost 5601
GinIntTest:-1@localhost 51747


However, even if you have multiple instances of a given application on different port numbers, you will only see one entry per application in the private WebObjects.conf file. Instead of adding a second entry, the WOApplication will overwrite a previous instance's entry. This is to facilitate rapid deployment and testing.


The WebObjects.conf Files In a Deployment


When and how often the WebObjects.conf file is read depends on your adaptor configuration. Because it does not store state, the CGI adaptor checks the file once per transaction. Other adaptors can be configured at compile time. Two variables are set in the config.h file that is part of the adaptor source distribution:

#define READ_CONF_ONCE 0
#define CONF_STAT_INTERVAL 10


If READ_CONF_ONCE is set to a value greater than zero, the WebObjects.conf files are read once at startup and then never consulted again. The CONF_STAT_INTERVAL value determines how often, in seconds, the public WebObjects.conf file is stat()'ed. If the time stamp of this file has changed, the file is reloaded.

If the adaptor receives a request for an application that is not in the public conf file, it will then drop down to look at the private conf file. If the adaptor can't find the application in either place, then it will pop out a "Application can not be found" error.

Published Date: Feb 18, 2012