WebObjects services do not start during system startup after using Applications Server Update 2.0

If you install the version of Applications Server Update 2.0 that was available prior to 18 March 2004 on Mac OS X Server 10.3.3, WebObjects 5.2.3 services do not start during system startup.
Important: Users who are unfamiliar with command line interface and manual configuration in general should proceed with caution or preferably seek assistance. Assistance in setting up or creating Startup Items is not part of Apple's complimentary technical support for new products. Users interested in fee-based support for setting up and creating Startup Items or shell scripts should contact Apple Professional Services.

Symptom

WebObjects services (wotaskd and, optionally, JavaMonitor) normally start automatically during the operating system's startup process. But after installing Applications Server Update 2.0, WebObjects 5.2.3 services do not start. This will prevent deployed WebObjects applications managed by JavaMonitor from starting automatically and from being managed by JavaMonitor.

Notes:
  1. WebObjects 5.2.3 Developer is not affected.
  2. If you obtained Applications Server Update 2.0 on 18 March 2004 or later, you do not need to perform the solution.

Solution

Two files deleted from /System/Library/StartupItems/WebObjects by Applications Server Update 2.0 must be replaced. After doing so, WebObjects services will automatically start during system startup. Follow these steps:
  1. Be sure you are logged in to the server with an administrator account.
  2. Open Terminal, and execute these commands:

    # cd ~
    # mkdir WO523
    # cd WO523
    # pico StartupParameters.plist

  3. Carefully copy the text below, and paste it into the pico editor in the Terminal window.

    Begin copying below this line.


    {
      Description     = "WebObjects Services";
      Provides        = ("WebObjects Services");
      Requires        = ("Disks", "Network");
      OrderPreference = "Last";
      Messages =
      {
        start = "Starting WebObjects Services";
        stop  = "Stopping WebObjects Services";
      };
    }
    
    

    End copying above this line.

  4. Save the file (Control-O, Return), and exit pico (Control-X).
  5. Execute this command in Terminal:

    # pico WebObjects

  6. Carefully copy the text below, and paste it into the pico editor in the Terminal window.

    Begin copying below this line.


    #!/bin/sh
    #
    # Start and Stop WebObjects Services
    #
    
    . /etc/rc.common
    
    
    WOSERVICE="/System/Library/WebObjects/JavaApplications/wotaskd.woa/\\
    Contents/Resources/javawoservice.sh"
    
    WOTASKD="/System/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd"
    WOJAVAMONITOR="/System/Library/WebObjects/JavaApplications/\\
    JavaMonitor.woa/JavaMonitor"
    
    GREP=/usr/bin/grep
    AWK=/usr/bin/awk
    PS=/bin/ps
    
    PRINTSTARTSTOPMESSAGES="YES"
    
    ##
    # Start WebObjects services
    # (Services to be stopped by this script must use "javawoservice.sh".)
    ##
    StartService ()
    {
        if [ -x "$WOSERVICE" ]; then
    
            if [ "$PRINTSTARTSTOPMESSAGES" = "YES" ]; then
                ConsoleMessage "Starting WebObjects services"
            fi
    
            if [ -e /var/log/webobjects.log ]; then
                mv /var/log/webobjects.log /var/log/webobjects.log.1
            fi
    
            ####
            # This set of invocations will launch wotaskd and
            # (optionally) Monitor as root.  This is less secure than
            # starting as 'appserver'
    
            "$WOSERVICE" -appPath "$WOTASKD" >/var/log/webobjects.log \\
    2>&1 & 
    
            # Uncomment the next line to start Monitor as root at boot time
            #"$WOSERVICE" -appPath "$WOJAVAMONITOR" -WOPort 56789 \\
            #-WOAutoOpenInBrowser NO >> /var/log/webobjects.log 2>&1 & 
            ####	
    
            ####
            # OSX Server now has the 'appserver' and 'appserveradm'
            # It is recommended that apps be started as the 'appserver'
            # instead of 'root'
            #
            #/usr/bin/su appserver -c "$WOSERVICE -appPath $WOTASKD" > \\
            #/var/log/webobjects.log 2>&1 & 
            #
            #/usr/bin/su appserver -c "$WOSERVICE -appPath $WOJAVAMONITOR \\
            #-WOPort 56789 -WOAutoOpenInBrowser NO" >> \\
            #/var/log/webobjects.log 2>&1 & 
            #
            ####
    	
        fi
    }
    
    ##
    # Stop WebObjects Services
    # (Stop all services run by "javawoservice.sh".)
    ##
    StopService ()
    {
        if [ "$PRINTSTARTSTOPMESSAGES" = "YES" ]; then
            ConsoleMessage "Stopping WebObjects services"
        fi
    
        WOSERVICEPIDS=`$PS -jaxwwwww | $GREP "$WOSERVICE" | \\
    $GREP -v grep | $AWK '{print $2}'`
    
        parents=""
        children=""
            
        for parent in $WOSERVICEPIDS
        {
            WOSERVICECHILDPIDS=`$PS -jaxwwwww | \\
    $AWK 'NF>3 {if ( $3 =='"$parent"' ) print $2}'` 
            parents="$parents $parent"
    
            for child in $WOSERVICECHILDPIDS
            {
                children="$children $child"  
            }
    
    }
            
    #kill them all at once
        kill $parents $children
    }
    
    ##
    # Restart WebObjects Services
    ##
    RestartService ()
    {
        ConsoleMessage "Restarting WebObjects services"
    
        PRINTSTARTSTOPMESSAGES="NO"
    
        StopService
        StartService
    }
    
    ##
    # Stop Process by PID
    ##
    StopPID ()
    {
        `kill "$1"`
    }
    
    RunService "$1"
    
    

    End copying above this line.

  7. Save the file (Control-O, Return), and exit pico (Control-X).
  8. In Terminal, execute these commands. Note that the first use of sudo will prompt you for your administrator password.

    # cd /System/Library/StartupItems/WebObjects
    # sudo mv ~/WO523/StartupParameters.plist .
    # sudo mv ~/WO523/WebObjects .
    # sudo chown root:wheel StartupParameters.plist WebObjects
    # sudo chmod 644 StartupParameters.plist
    # sudo chmod 755 WebObjects

  9. Test the validity of the WebObjects shell script with the following command. Fix any errors before proceeding.

    # sh -n WebObjects

  10. Execute this command to start WebObjects services:

    # sudo SystemStarter start "WebObjects Services"


You were successful if the output contains "Starting WebObjects services" followed by "Startup complete."
Published Date: Oct 7, 2016