Documentation Archive Developer
Search

Table of Contents Previous Section

Starting Up Applications From the Command Line

The syntax for starting a WebObjects application from a command shell window is:

AppExecutable [-debug ON|OFF] [-browser ON|OFF] [-m ON|OFF [-mhost hostname|subnet]] [-c] [-d DocumentRoot] [[-a AdaptorClass] [-n InstanceNumber] [-p PortNumber] [-q ListenQueueDepth]] [ApplicationName]

AppExecutable
The name of the WebObjects application executable to run. You should enter the command from the directory containing the executable. Compiled applications should either be located in NeXT_ROOT/NextLibrary/WOApps (recommended) or under <DocRoot>/WebObjects. For scripted applications, go to the application's .woa directory and execute WODefaultApp, which is located in NeXT_ROOT/NextLibrary/Executables.
-debug ON|OFF
Sets whether the application prints messages to standard output during startup. By default, this option is ON. If this option is ON, the application prints messages such as the following:
                Aug 22 18:08:46 WODefaultApp[423] Application Path: 

                /NextDeveloper/Examples/WebObjects/HelloWorld

                Aug 22 18:08:50 WODefaultApp[423] Application Base URL: 

                /WebObjects/Examples/HelloWorld

                Aug 22 18:08:50 WODefaultApp[423] Application Name: 

                Examples/HelloWorld

                Aug 22 18:08:51 WODefaultApp[423] Reading WebServer configuration 

                from /NextLibrary/WOAdaptors/Configuration/WebServerConfig.plist.

                Aug 22 18:08:51 WODefaultApp[423] Opening application's URL in 

                Browser:

                http://localhost/cgi-bin/WebObjects/Examples/HelloWorld

                Aug 22 18:08:54 WODefaultApp[423] waiting for requests...

-browser ON|OFF
Sets whether the application automatically starts up the web browser. The default is ON. If this option is ON, the browser automatically opens a new browser window (starting up the browser if necessary) with the WebObjects application's URL.
-m ON|OFF
Enables or disables monitoring. The default is ON. If this option is ON and you manually start up an application, the application tries to find a running Monitor. If it finds one, Monitor can automatically locate the application and display information about it, provided an instance number is given with the adaptor's -n option as described below.
-mhost hostname | subnet
The application tries to find a running Monitor on the machine named hostname instead of on the local machine. If subnet is used, the application looks for a running Monitor in its network subnet.
-c
Requests that the application cache component definitions (templates) instead of reparsing HTML and declaration files upon each new HTTP request. By default, applications do not cache component definitions. This setting ensures that during development of scripted applications programmers can modify a component's logic and see the result without having to relaunch the application. If you are deploying applications, however, you should turn on component-definition caching by specifying this flag when you launch the application.
-d DocumentRoot
The document root of the server, which can be different from the document root specified for a given web server. If you use this option, you must also specify the ApplicationName option. If you don't specify a document root, it is taken from the configuration file NeXT_ROOT/NextLibrary/WOAdaptors/Configuration/WebServerConfig.plist.
-a AdaptorClass
The class of an adaptor that the application will use to communicate with the server. You can specify multiple adaptors, as long as they are of different types. (For example, you could have a separate adaptor with its own port for communicating directly with Java applets on the browser.) If you specify multiple HTTP adaptors, only the last one specified will be made the active one.

The subsequent three arguments belong to the adaptor specified in AdaptorClass; the first two of these are used in load balancing: You cannot specify adaptor arguments unless you specify an adaptor class.

-n InstanceNumber
A positive integer that uniquely identifies an application instance with which the adaptor will communicate. If you do not specify an instance number, the adaptor specified in AdaptorClass creates one using random number generation. If a URL does not specify the instance number, the application is presumed to run on the server machine as a single instance application, as if it had been autostarted. If you specify AdaptorClass for the purpose of load balancing, you must specify an instance number.
Note that if you intend to use Monitor to administer the application, you must use the -n option. Monitor always assigns instances to the applications it knows about. If you start up an application without the -n option, its instance number is nil, and Monitor is not able to connect to it.
-p PortNumber
Specifies the socket port used to communicate with an application instance. Port numbers must be over 1024 since numbers between 0 and 1024 are reserved. If you specify AdaptorClass for the purpose of load balancing, you must specify a port number.
-q ListenQueueDepth
Specifies the queue depth on a TCP/IP socket at the entrance of the application. The default listen queue depth is 4, meaning that while the application process is handling a request, up to four other requests can be in the socket buffer before the socket starts refusing them. If the application is expected to experience "spikes" in its processing load, it might be a good idea to increase the listen queue depth. Increasing this default does not necessarily improve performance or allow the application to serve more requests at sustained high loads. For more information, see "Increasing the Listen Queue Depth" in this guide.
ApplicationName
Specifies the application name, which is the directory path relative to <DocRoot>/WebObjects. This argument is required when you use the -d option to specify the document root.

Examples

The following example starts the scripted application TimeOff on Windows NT:

> cd <DocRoot>\Examples\WebScript\TimeOff.woa

> WODefaultApp.exe Examples/WebScript/TimeOff

The following example starts a compiled WebObjects example application on Mach, assigning it the default HTTP (CGI) adaptor and specifying port and instance numbers for that adaptor. Because an instance number is specified, if a Monitor is running on that machine, it can display application activity and shut down the application.

> HelloWorldCompiled -d /NextLibrary/WebServer/htdocs -a WODefaultAdaptor 

-n 1 -p 3000 -q 50 Examples/ObjC/HelloWorldCompiled

Notes

The web server uses the <DocRoot> and ApplicationName arguments to build URLs, so you should use forward slashes as opposed to a backslashes when specifying these arguments.

As a convenience, you might create a shell script that starts WebObjects applications when the server machine is booted. You also might create another shell script that you can run at the command line to start applications.

Table of Contents Next Section