WO 5.4 Getting Started

Version 45.1 by David Holt on 2008/10/29 12:24
Warning: For security reasons, the document is displayed in restricted mode as it is not the current version. There may be differences and errors due to this.

Installing WebObjects and WOLips

Download Xcode 3 from ADC, the WebObjects frameworks are included in this package. You will have to make a custom install and select WebObjects in the package list since WebObjects is not part of the default installation.

Install Eclipse 3.3.2

Install WOLips from the stable build server.  (nightly only works with Eclipse 3.4, not recommended yet).

Start Eclipse and switch to the WOLips perspective.  To achieve this, open the Window menu, select Open Perspective and select Other....

PerpectiveMenu.png

In the perspective choices, select WOLips and click Ok.

PerspectiveChoices.png

If you don't switch to the WOLips perspective, you won't be able to create new WebObjects projects.

You are now ready to create projects or importing the examples. 

Running the examples

Apple has converted their WebObjects examples in the Eclipse format, but no documentation is provided on how to import them into Eclipse.  The examples are in /Developer/Examples/JavaWebObjects.

The first step is: install Eclipse and WOLips :-)  

Some examples needs Derby, an embedded Java database (OpenBase is not included with WO anymore).  To install the databases, you have to do:


cd /Developer/Examples/JavaWebObjects/
sudo sh installDatabases.sh <yourusername>

Now, you can import the examples into Eclipse.  Start Eclipse, select File > Import,

ImportMenu.png

and select General > Existing Projects into Workplace.

ImportGeneral.png

On the next page, select Select root directory and browse your disk to /Developer/Examples/JavaWebObjects.  You should see a list of projects to import.&nbsp; Deselect the second javaeoutil project, or else you won't be able to import the projects.

ImportProjectsList.png

After the importation is done, you should see the projects in the WO Package Explorer.  If you see the projects in Package Explorer (without "WO" in the name), that means that you are using the Java perpective instead of the WOLips perpective.&nbsp; Switch the perpective to WOLips.

PackageExplorer.png

Now, you need to fix the examples, because the build path is pointing to the source projects of the WO frameworks, source that nobody outside Apple has access to :-)For each project, right-click on each project, select Build Path > Configure Build Path...

BuildPathMenu.png

Click on the Projects tab, select the references to the WO frameworks that have the Warning icon and click Remove.

ConfigureBuildPath.png

Click on the Libraries tab, click the Add Library button.&nbsp; Select WebObjects Frameworks and click Next.

AddLibrary.png

Click System, open the triangle next to System and make sure that JavaEOAccess, JavaEOControl, JavaFoundation, JavaWebObjects, JavaWOExtensions and JavaXML are selected.  For SchoolToolsClient, you also need to add JavaWebServicesSupport and JavaWebServicesClient to the build path.  For the SchoolToolsServer, you need to add JavaWebServicesSupport.

WOSystemLibs.png
&nbsp;

After you corrected the build path on a project, the project will rebuild itself and the errors shoud dissapear.

JavaBusinessLogic and RelatedLinks requires Apache Derby, but the path to Derby's JAR is wrong. Remove the JAR from the build path, click Add External JARs..., browse your disk up to /Developer/Examples/JavaWebObjects/Databases/db-derby-10.2.2.0-bin/lib and select derby.jar.&nbsp; The build path should look like this:

GoodDerbyPath.png

VoilĂ &nbsp; You finally can run the examples.&nbsp;

Running Monitor and wotaskd on Mac OS X 10.5 "client"

Monitor and wotaskd are installed, but the launchd scripts to start them are not installed.  You can grab them from a 10.5 Server installation, or follow those instructions.

Make sure Web Sharing is enabled in the Sharing panel in System Preferences (note: 10.5 comes with Apache 2.2 as the default).

Edit /etc/apache2/httpd.conf (if you did a fresh install, you may already have these - search httpd.conf first)

Search for rewritemodule, and above it, add this line:


LoadModule WebObjects_module /System/Library/WebObjects/Adaptors/Apache2.2/mod_WebObjects.so

Go to the very end and add:


Include /System/Library/WebObjects/Adaptors/Apache2.2/apache.conf

Search for "Directory /" and comment out the Order and Deny lines:


<Directory />
    Options FollowSymLinks
    AllowOverride None
    #Order deny,allow
    #Deny from all
</Directory>

Restart apache


sudo apachectl graceful

If you run ps auxw  grep httpd you should see apache now running

Create /Library/LaunchDaemons/com.apple.webobjects.wotaskd.plist with:
(for OSX 10.5 make sure the permissions of this file are 644 system/wheel/everyone otherwise launchctl will throw a "dubious permissions" error when you try to load the plist with the commands that follow)


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>GroupName</key>
<string>appserverusr</string>
<key>Label</key>
<string>com.apple.webobjects.wotaskd</string>
<key>OnDemand</key>
<false/>
<key>Program</key>
<string>/System/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd</string>
<key>ProgramArguments</key>
<array>
<string>wotaskd</string>
<string>-WOPort</string>
<string>1085</string>
</array>
<key>ServiceIPC</key>
<false/>
<key>UserName</key>
<string>appserver</string>
</dict>
</plist>

Create /Library/LaunchDaemons/com.apple.webobjects.womonitor.plist with:
(for OSX 10.5 make sure the permissions of this file are 644 system/wheel/everyone otherwise launchctl will throw a "dubious permissions" error when you try to load the plist with the commands that follow)


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>GroupName</key>
<string>appserverusr</string>
<key>Label</key>
<string>com.apple.webobjects.womonitor</string>
<key>OnDemand</key>
<false/>
<key>Program</key>
<string>/System/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor</string>
<key>ProgramArguments</key>
<array>
<string>JavaMonitor</string>
<string>-WOPort</string>
<string>56789</string>
</array>
<key>ServiceIPC</key>
<false/>
<key>UserName</key>
<string>appserver</string>
</dict>
</plist>

Start the launchd daemons :
(you may need to sudo here)


launchctl load /Library/LaunchDaemons/com.apple.webobjects.wotaskd.plist
launchctl load /Library/LaunchDaemons/com.apple.webobjects.womonitor.plist

If you run "ps auxw  grep java" you should see wotaskd and java monitor now running.  You should be able to connect to Monitor by this URL:


http://localhost:56789

Developing with both WebObjects 5.4 and 5.3

(Mike Schrag) The following can be done a couple ways, but this is just how I happened to have things setup in betas, so I kept it (it worked for me):

Make a /System/Library/Frameworks/WebObjects54 folder, and move the following frameworks from the 5.4 install into it:


JavaDTWGeneration.framework
JavaDirectToWeb.framework
JavaEOAccess.framework
JavaEOApplication.framework
JavaEOControl.framework
JavaEODistribution.framework
JavaEOGeneration.framework
JavaEOInterface.framework
JavaEOInterfaceCocoa.framework
JavaEOInterfaceSwing.framework
JavaEOProject.framework
JavaEORuleSystem.framework
JavaEOTool.framework
JavaFoundation.framework
JavaJDBCAdaptor.framework
JavaJNDIAdaptor.framework
JavaWOExtensions.framework
JavaWOJSPServlet.framework
JavaWebObjects.framework
JavaWebServicesClient.framework
JavaWebServicesGeneration.framework
JavaWebServicesSupport.framework
JavaXML.framework

Make a /System/Library/Frameworks/WebObjects53 folder, and move the following frameworks from your old 5.3 install into it (I tar'd these up from 5.3 before upgrading, but you can download 5.3 and extract these from the pkg, or POSSIBLY install them with the actually installer ... YMMV on that one)


JavaDTWGeneration.framework
JavaDirectToWeb.framework
JavaEOAccess.framework
JavaEOApplication.framework
JavaEOCocoa.framework
JavaEOControl.framework
JavaEODistribution.framework
JavaEOGeneration.framework
JavaEOInterface.framework
JavaEOInterfaceCocoa.framework
JavaEOInterfaceSwing.framework
JavaEOProject.framework
JavaEORuleSystem.framework
JavaEOTool.framework
JavaFoundation.framework
JavaJDBCAdaptor.framework
JavaJNDIAdaptor.framework
JavaWOExtensions.framework
JavaWOJSPServlet.framework
JavaWebObjects.framework
JavaWebServicesClient.framework
JavaWebServicesGeneration.framework
JavaWebServicesSupport.framework
JavaXML.framework

I then use the following two scripts to be able to switch between using 5.3 and 5.4 system wide:


bash-3.2# cat wo53
for framework in `ls /System/Library/Frameworks/WebObjects53`; do rm /System/Library/Frameworks/$framework; \
ln -sf /System/Library/Frameworks/WebObjects53/$framework /System/Library/Frameworks/$framework; done
bash-3.2# cat wo54
for framework in `ls /System/Library/Frameworks/WebObjects54`; do rm /System/Library/Frameworks/$framework; \
ln -sf /System/Library/Frameworks/WebObjects54/$framework /System/Library/Frameworks/$framework; done

At this point, you should have NO WO frameworks in /System/Library/Frameworks  they should be in subfolders.

Now go ahead and run wo53, which should now give you WO 5.3 framework symlinks.

You may need to do a clean build of your projects in Eclipse  If things are setup properly, you should not get any Java errors you didn't already have.

Alternative 5.3 / 5.4 development method

The ^woswitch script can be used as an alternative method to installing and using WO 5.3 for development, without the need to touch or move any of the installed WO 5.4 frameworks. This script will download and install the WebObjects 5.3.3 runtime into /Developer/WebObjects53 and maintain two copies of your /Library/wobuild.properties so you can quickly switch WOLips development between the two different runtime versions.

To use the script for the first time, ensure that you have WebObjects 5.4 installed, and have run WOLips at least once to create your /Library/wobuild.properties file. Also ensure that the script has been set executable with chmod x woswitch

Then run it like this:

Unknown macro: noformat. Click on this message for details.

This can take quite some time the first time as it downloads, extracts and sets the WO 5.3 runtime up. After this is done, switching between the two runtimes is almost instant.

To switch between the two runtimes, quit WOLips and run

Unknown macro: noformat. Click on this message for details.

Then run WOLips again.

One thing to remember is that when you are installing frameworks they need to be installed into the appropriate location for the runtime you are targeting. For WO 5.4 you need to install them into /Library/WebObjects/Frameworks and for WO 5.3 they need to go into /Developer/WebObjects53/Library/Frameworks

Keep in mind that these changes are specific to WOLips and woproject only. If you run anything outside of WOLips you will also need to manually set NEXTROOT appropriately.