WO 5.4 Getting Started

Version 61.1 by Pascal Robert on 2007/11/29 14:04

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.1.1 (yes that's an extra .1) which fixes the permgen space bug from 3.3.1

Install WOLips from the nightly build server

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 Prefs Panel

Note: /etc/httpd is out, /etc/apache2 is in
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 a


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:


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


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


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

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.