You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 65 Next »

Install Sun Java JDK

1. You should install a Sun/Oracle Java SDK. Use Oracle's installation instructions. Choose the appropriate 32-bit or 64-bit Linux installer, for example jdk-6u27-linux-x64-rpm.bin, and install it.

Make sure to install the correct "bit" version for the OS, e.g. install 64 bit JVM on a 64 bit installation, and a 32 bit JVM on a 32 bit installation! To find that information, do:

uname -p

If the response is x86_64, it's a 64 bit system. If the response is i386 or i686, it's a 32 bit system.

Creating symbolic links as follows is useful (alternatively use the 'alternatives' command to manage JVMs):

ln -s /usr/java/jdk1.6.0_27 /usr/java/jdk1.6
ln -s /usr/java/jdk1.6/bin/java /usr/bin/java

and you need to change your path in your bash profile (_~/.bash_profile) to have this path :

PATH=$PATH:/usr/java/jdk1.6/bin:$HOME/bin

Install WebObjects

2. Get the WebObjects installer from the wocommunity's Web site :

curl -C - -O http://wocommunity.org/documents/tools/WOInstaller.jar

     OR

wget http://wocommunity.org/documents/tools/WOInstaller.jar

and install it like this :

sudo /usr/java/jdk1.6/bin/java -jar WOInstaller.jar 5.4.3 /opt

WebObjects frameworks are now installed in /opt

[root@ ~]# ls -l /opt
total 12
drwxr-xr-x 3 root root 4096 Nov  9 08:19 Developer
drwxr-xr-x 4 root root 4096 Nov  9 08:19 Library
drwxr-xr-x 3 root root 4096 Nov  9 08:20 Local

To follow the conventions from Mac OS X, we will create two users to run wotaskd and Monitor under this user :

sudo groupadd appserveradm
sudo useradd -g appserveradm appserver

Edit the bash profile of the appserver

#sudo su - appserver
% vi .bash_profile

and add this line :

export NEXT_ROOT=/opt

and run it manually in your current shell :

[appserver@ ~]$ . .bash_profile

3. Next, we need to install the Wonder version wotaskd and JavaMonitor.

mkdir -p /opt/Local/Library/WebObjects/JavaApplications
cd /opt/Local/Library/WebObjects/JavaApplications

wget http://jenkins.wocommunity.org/job/Wonder/lastSuccessfulBuild/artifact/Root/Roots/wotaskd.tar.gz
tar zpxf wotaskd.tar.gz
rm wotaskd.tar.gz
wget http://jenkins.wocommunity.org/job/Wonder/lastSuccessfulBuild/artifact/Root/Roots/JavaMonitor.tar.gz
tar zpxf JavaMonitor.tar.gz
rm JavaMonitor.tar.gz

4. Now we need to change some permissions:

chown -R appserver:appserveradm /opt/Local
chown -R appserver:appserveradm /opt/Library

5. Now we can start wotask and Monitor

[root@ ~]# su - appserver

You can start wotaskd and Monitor to make sure that they run without any problems :

[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 step : compiling and installing the Apache module

For Ubuntu distributions :
sudo apt-get install apache2 apache2.2-common apache2-mpm-prefork apache2-utils apache2-threaded-dev ssl-cert

On that system the relevant command names are apache2ctl and apxs2, and the document root is /var/www (not /usr/local/apache/htdocs as in the example below).

(you will need httpd-devel and gcc)

For CentOS, RedHat or Fedora distributions :
yum install httpd mod_ssl httpd-devel
chkconfig httpd on
/etc/init.d/httpd start

.. default install location is then /etc/httpd

HTTP Adaptor

You can also find pre-built binaries of the module 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.

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) :

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)

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

ln -s /usr/sbin/apxs2 /usr/sbin/apxs

Apache Configuration

Instead of copying the WebObjects directory, you can use a alias to point to the folder inside NEXT_ROOT. In your Apache configuration, add something like :

Alias /WebObjects "/opt/Local/Library/WebServer/Documents/WebObjects"

and add a directive to allow fetching files in this directory:

<Directory "/opt/Local/Library/WebServer/Documents/WebObjects">
      AllowOverride All
      Order allow,deny
      Allow from all
</Directory>

Or (depending on your Apache configuration) you could use a symbolic link.

You also need, as explained by the adaptor's README file, to add this directive in httpd.conf :

<LocationMatch /apps/WebObjects/.*>
    Order allow,deny
    Allow from all
</LocationMatch>

If you don't add it, you will get 403s (Forbidden) HTTP errors.

If you want to keep /cgi-bin/WebObjects as the base URL, you will need to remove a line in httpd.conf. Find the line that starts with ScriptAlias /cgi-bin and comment it out, or else Apache will try to find a WebObjects CGI in /cgi-bin instead of loading the adaptor from the Apache module.

And edit /usr/local/apache/conf/extra/webobjects.conf to comment the LoadModule WebObjects_module line. You can also change the WebObjectsAlias property, in my case I use /apps/WebObjects. Last step : add the following line in httpd.conf (near the end):

Include conf/extra/webobjects.conf

Check for any errors with apachectl configtest, and if everything's ok, you are good to go. You can install your first app, don't forget that your app must be accessible by the appserver user or the appserveradm group. If your app don't start or if Monitor complains about a path, it might be a permission problem.

Jerome Chan told me that you can check if the Apache module is loaded by doing this :

/usr/local/apache/bin/apachectl -M

On my installation on OpenSuse 11.1, I had to change the path to the lib64 directory where Apache contains the modules.

LoadModule WebObjects_module /usr/lib64/apache2/mod_WebObjects.so

Auto Start WOTaskd and WOMonitor

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

#!/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 :
sudo /sbin/chkconfig --add webobjects
sudo /sbin/chkconfig webobjects on
For Ubuntu :
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:

description     "Start webobjects services"
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
env WOMONITOR_LOG=/var/log/webobjects/womonitor.log

respawn
respawn limit 15 5

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

Comment out the JavaMonitor part if you don't use the Monitor on that server (you need a wotaskd on each host, but only one monitor for a given set of hosts).
Drop the above into /etc/init/ (note NOT init.d) and start it initially with:

service webobjects start

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

chown root /etc/init.d/webobjects
chmod 755 /etc/init.d/webobjects

Problems with Application Responding to WOMonitor/WOTaskd

If your Linux server is a virtual machine or if it has multiple IP addresses, you may find that clicking 'Stop' in WOMonitor has no effect on instances, or that the applications never start (the level just go up and down non-stop). This can usually be solved for all Wonder-based applications running on hosts with such a problem by simply creating the following file (known as the 'Machine Properties' file in Wonder's ERXProperties):

/etc/WebObjects/Properties

And inside that file, add an array property that defines all the IP addresses assigned to your host, for example:

er.extensions.WOHostUtilities.localhostips=(192.168.3.168,192.168.1.168)

To learn more, see the class named WOHostUtilities in ERExtensions framework

SELinux

If SELinux is enabled on your system, wotaskd won't run because of SELinux policies. You need to run :

sudo setsebool -P httpd_can_network_connect=1

Additional Resources

Jonathon Rentzsch WOPlat Project 'WOInstaller + Wonder Web Server Adaptor + OS Support Files'
http://vmadmin.nt.com.au/?p=47
http://www.watermarkstudios.com/blog/?p=48

  • No labels