Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
[appserver@ ~]$ $NEXT_ROOT/Local/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd &
[appserver@ ~]$ $NEXT_ROOT/Local/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 &

Apache

6. Last First step : compiling and installing the Apache modulehttpd

For Ubuntu distributions :

...

.. default install location is then /etc/httpd

HTTP Adaptor

You can also find First, check if a pre-built binaries of the module already exists at wocommunity.org.

If no pre-built binaries exist for your platform, follow those instructions:

Get the source of the module (adaptor) from Wonder. You only need the Adaptors (and its subfolders) folder.

Code Block

wget https://github.com/projectwonder/wonder/tarball/master
OR
curl -C - -O https://github.com/projectwonder/wonder/tarball/master

Edit make.config and change the value of ADAPTOR_OS to LINUX. (this can be found in Adaptors directory (JS)) (Adaptors directory is now under %PATH_OF_UNZIPPED_SOURCE%/Utilities )

If using modern Ubuntu (and OpenSuse 11.1 too) releases, you'll find that srandom is missing, so as mentioned on the list (JL) :

Code Block

At line 46 in Adaptor/random.c, just remove the check for WIN32, and use the initialisation
code in that block.  That is, change this:

#if defined(WIN32)
   time_t now;
   time(&now);
   srand(now);
#else
   srandomdev();
#endif

to this:

   time_t now;
   time(&now);
   srand(now);

Go to the ApacheXX folder that match your Apache version. In my case, I'm using Apache 2.2 built from source and installed in /usr/local/apache.

In another case I ran 'make CC=gcc' in the Adaptors directory then moved to the Apache2.2 directory. (JS)

...

If you are running CentOS 6.x, you can use the module for CentOS 5.5, it works fine.

Once you have downloaded the module, you can install it with:

Code Block
sudo apxs -i -a -n WebObjects mod_WebObjects.so

Compiling the HTTP adaptor

If no pre-built binaries exist for your platform or your version of Apache httpd, follow those instructions:

Get the source of the module (adaptor) from Wonder. You only need the Adaptors (and its subfolders) folder.

Code Block

wget https://github.com/projectwonder/wonder/tarball/master
OR
curl -C - -O https://github.com/projectwonder/wonder/tarball/master

Edit make.config and change the value of ADAPTOR_OS to LINUX. (this can be found in Adaptors directory (JS)) (Adaptors directory is now under %PATH_OF_UNZIPPED_SOURCE%/Utilities )

If using modern Ubuntu (and OpenSuse 11.1 too) releases, you'll find that srandom is missing, so as mentioned on the list (JL) :

Code Block

At line 46 in Adaptor/random.c, just remove the check for WIN32, and use the initialisation
code in that block.  That is, change this:

#if defined(WIN32)
   time_t now;
   time(&now);
   srand(now);
#else
   srandomdev();
#endif

to this:

   time_t now;
   time(&now);
   srand(now);

Go to the ApacheXX folder that match your Apache version. In my case, I'm using Apache 2.2 built from source and installed in /usr/local/apache.

In another case I ran 'make CC=gcc' in the Adaptors directory then moved to the Apache2.2 directory. (JS)

Code Block

[root@ Adaptors]# make CC=gcc
[root@ Adaptors]# cd Apache2.2/
[root@ Apache2.2]# apxs -i -a -n WebObjects mod_WebObjects.la
[root@ Apache2.2]# cp -rp /opt/Local/Library/WebServer/Documents/WebObjects /usr/local/apache/htdocs
[root@ Apache2.2]# cp apache.conf /usr/local/apache/conf/extra/webobjects.conf

In OpenSuse 11.1, using Yast, you need to install the apache_devel, in order to get apxs2. I needed to create a symlink called apxs, pointing to apxs2, in order to run the make correctly.

...

One last thing, you need a init script to start wotaskd and Monitor at boot time. This is the one I wrote :

Code Block

#!/bin/bash

# chkconfig: - 90 20
# description: Provides WebObjects services

# Source function library.
. /etc/rc.d/init.d/functions

NEXT_ROOT="/opt"
export NEXT_ROOT

PATH="/bin:/usr/bin:/usr/java/jdk1.5/bin"
export PATH

USER=appserver

# See how we were called.
case "$1" in
	start)
		echo -n "Starting wotaskd and Monitor: "
		su $USER -c "$NEXT_ROOT/Local/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd -WOPort 1085 &"
		su $USER -c "$NEXT_ROOT/Local/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 &"
		echo
		;;
	stop)
		echo -n "Shutting down wotaskd and Monitor: "
		WOTASKD_PID=`ps aux | awk '/WOPort 1085/ && !/awk/ {print $2}'`
		kill $WOTASKD_PID
		MONITOR_PID=`ps aux | awk '/WOPort 56789/ && !/awk/ {print $2}'`
		kill $MONITOR_PID
		echo
		;;
	restart)
		$0 stop
		$0 start
		;;
	*)
		echo -n "Usage: $0 {start|stop|restart}"
		exit 1
esac

if [ $# -gt 1 ]; then
	shift
	$0 $*
fi

exit 0

Save the script as /etc/init.d/webobjects

You also need to add the script with chkconfig so that everything start up after a reboot. If you named the above script as "webobjects", do :

For CentOS, RedHat or Fedora distributions :
Code Block
sudo /sbin/chkconfig --add webobjects
sudo /sbin/chkconfig webobjects on
For Ubuntu :
Code Block
sudo update-rc.d webobjects defaults 90 20

A better choice for Ubuntu (later releases anyway) is to use upstart instead of rc.d. One major benefit is that you can configure upstart to respawn your instance of wotaskd if it crashes unexpectedly. This is an example of our upstart conf for wotaskd:

Code Block

description     "Start wotaskd service"
author          "David LeBer"

start on runlevel [2345]
stop on runlevel [!2345]

env USER=appserver
env NEXT_ROOT=/opt
env WOTASKD_LOG=/var/log/webobjects/wotaskd.log

respawn
respawn limit 15 5

script
        echo "Launching wotaskd"
        su - $USER -c "$NEXT_ROOT/Local/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd -WOPort 1085 >> $WOTASKD_LOG 2>&1"
        emit wotaskd_running
end script

Drop the above into /etc/init/wotaskd.conf (note NOT init.d) and start it initially with:

Code Block
service wotaskd start

. Make a similar script for womonitor if needed. Create /var/log/webobjects directory if not already present, or change the log paths to your desired target directory.

Systems using upstart (Ubuntu and maybe others)

If you are running Ubuntu that have support for upstart, you can grab the two startup scripts for upstart on GitHub. Grab the two files (womonitor.conf and wotaskd.conf) and copy them in /etc/init/. Once they are in this directory, run:

Code Block
sudo service wotaskd start
sudo service womonitor start
Info

Don't forget to change the permissions on the startup file so that the owner is root and that everyone have execution rights!

Code Block

chown root /etc/init/wotaskd.conf
chown root /etc/init/womonitor.conf
chmod 755 /etc/init/wotaskd.conf
chmod 755 /etc/init/womonitor.conf

Systems not using upstart (CentOS, RedHat, Fedora and others)

If you are running a system not capable of running upstart, like CentOS, RedHat or older versions of Ubuntu, you need to use the old-style init.d startup script. Again, the scripts are available on GitHub. Grab the two files (womonitor and wotaskd) and copy them in /etc/init.d/.

Once the scripts are in /etc/init.d/, you can start them:

Code Block
sudo service wotaskd start
sudo service womonitor start

Last step: add the startup scripts under chkconfig control with:

Code Block
sudo /sbin/chkconfig --add webobjects
sudo /sbin/chkconfig webobjects on

If you are using Ubuntu or Debian without upstart support, you need to use update-rc.d instead of chkconfig:

Code Block
sudo update-rc.d wotaskd defaults 90 20
sudo update-rc.d womonitor defaults 90 20
Info

Don't forget to change the permissions on the startup file so that the owner is root and that everyone have execution rights!

Code Block
chown root /etc/init.d/webobjectswotaskd
chown root /etc/init.d/womonitor
chmod 755 /etc/init.d/wotaskd
chmod 755 /etc/init.d/webobjectswomonitor

Problems with Application Responding to WOMonitor/WOTaskd

...