Wiki source code of WO 5.4 Getting Started

Version 46.1 by David Holt on 2008/10/29 12:24

Hide last authors
David Holt 43.1 1 {{toc}}{{/toc}}
Gavin Eadie 23.1 2
David Holt 43.1 3 = Installing WebObjects and WOLips =
David Avendasora 39.1 4
David Holt 43.1 5 Download Xcode 3 from [[ADC>>http://developer.apple.com/leopard/devcenter/]], 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.
David Avendasora 39.1 6
David Holt 43.1 7 Install [[Eclipse 3.3.2>>http://download.eclipse.org/eclipse/downloads/drops/R-3.3.2-200802211800/index.php]]
Gavin Eadie 23.1 8
David Holt 43.1 9 [[Install>>WOL:Install WOLips with Eclipse Update Manager]] WOLips from the [[stable>>http://webobjects.mdimension.com/wolips/stable]] build server. ([[nightly>>http://webobjects.mdimension.com/wolips/nightly]] only works with Eclipse 3.4, not recommended yet).
jbrook 41.1 10
David Holt 43.1 11 Start Eclipse and switch to the WOLips perspective. To achieve this, open the //Window// menu, select //Open Perspective// and select //Other...//.
jbrook 41.1 12
David Holt 31.1 13 [[image:PerpectiveMenu.png]]
David Holt 43.1 14
15 In the perspective choices, select //WOLips// and click //Ok//.
16
David Holt 31.1 17 [[image:PerspectiveChoices.png]]
Gavin Eadie 23.1 18
David Holt 31.1 19 If you don't switch to the WOLips perspective, you won't be able to create new WebObjects projects.
Timothy Worman 29.1 20
David Holt 43.1 21 You are now ready to create projects or importing the examples. 
Timothy Worman 29.1 22
David Holt 43.1 23 = Running the examples =
David Avendasora 35.1 24
David Holt 43.1 25 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//.
David Avendasora 35.1 26
David Holt 43.1 27 The first step is: install Eclipse and WOLips :-)  
28
29 Some examples needs Derby, an embedded Java database (OpenBase is not included with WO anymore). To install the databases, you have to do:
30
31 {{code}}
32
33 cd /Developer/Examples/JavaWebObjects/
34 sudo sh installDatabases.sh <yourusername>
35
36 {{/code}}
37
38 Now, you can import the examples into Eclipse. Start Eclipse, select //File// > //Import//,
39
40 [[image:ImportMenu.png]]
41
42 and select //General// > //Existing Projects// into Workplace.
43
44 [[image:ImportGeneral.png]]
45
46 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.
47
48 [[image:ImportProjectsList.png]]
49
50 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.
51
52 [[image:PackageExplorer.png]]
53
54 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...//
55
56 [[image:BuildPathMenu.png]]
57
58 Click on the //Projects// tab, select the references to the WO frameworks that have the Warning icon and click //Remove//.
59
60 [[image:ConfigureBuildPath.png]]
61
62 Click on the //Libraries// tab, click the //Add Library// button.&nbsp; Select //WebObjects Frameworks// and click //Next//.
63
64 [[image:AddLibrary.png]]
65
66 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//.
67
68 [[image:WOSystemLibs.png]]
69 &nbsp;
70
71 After you corrected the build path on a project, the project will rebuild itself and the errors shoud dissapear.
72
73 //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:
74
75 [[image:GoodDerbyPath.png]]
76
77 Voilà&nbsp; You finally can run the examples.&nbsp;
78
David Holt 45.1 79 = Running Monitor and wotaskd on Mac OS X 10.5 "client" =
David Holt 31.1 80
81 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.
82
Gavin Eadie 23.1 83 Make sure //Web Sharing// is enabled in the //Sharing// panel in //System Preferences// (note: 10.5 comes with Apache 2.2 as the default).
84
85 Edit ///etc/apache2/httpd.conf// (if you did a fresh install, you may already have these - search httpd.conf first)
86
David Holt 31.1 87 Search for rewrite//module, and above it, add this line~://
Gavin Eadie 23.1 88
89 {{code}}
90
91 LoadModule WebObjects_module /System/Library/WebObjects/Adaptors/Apache2.2/mod_WebObjects.so
92
93 {{/code}}
94
95 Go to the very end and add:
96
97 {{code}}
98
99 Include /System/Library/WebObjects/Adaptors/Apache2.2/apache.conf
100
101 {{/code}}
102
103 Search for "Directory /" and comment out the Order and Deny lines:
104
105 {{code}}
106
107 <Directory />
108 Options FollowSymLinks
109 AllowOverride None
110 #Order deny,allow
111 #Deny from all
112 </Directory>
113
114 {{/code}}
115
116 Restart apache
117
118 {{code}}
119
120 sudo apachectl graceful
121
122 {{/code}}
123
David Holt 31.1 124 If you run //ps auxw grep httpd// you should see apache now running
Gavin Eadie 23.1 125
126 Create ///Library/LaunchDaemons/com.apple.webobjects.wotaskd.plist// with:
David Holt 31.1 127 (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)
Gavin Eadie 23.1 128
129 {{code}}
130
131 <?xml version="1.0" encoding="UTF-8"?>
132 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
133 <plist version="1.0">
134 <dict>
135 <key>Disabled</key>
136 <false/>
137 <key>GroupName</key>
138 <string>appserverusr</string>
139 <key>Label</key>
140 <string>com.apple.webobjects.wotaskd</string>
141 <key>OnDemand</key>
142 <false/>
143 <key>Program</key>
144 <string>/System/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd</string>
145 <key>ProgramArguments</key>
146 <array>
147 <string>wotaskd</string>
148 <string>-WOPort</string>
149 <string>1085</string>
150 </array>
151 <key>ServiceIPC</key>
152 <false/>
153 <key>UserName</key>
154 <string>appserver</string>
155 </dict>
156 </plist>
157
158 {{/code}}
159
160 Create ///Library/LaunchDaemons/com.apple.webobjects.womonitor.plist// with:
David Holt 31.1 161 (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)
Gavin Eadie 23.1 162
163 {{code}}
164
165 <?xml version="1.0" encoding="UTF-8"?>
166 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
167 <plist version="1.0">
168 <dict>
169 <key>Disabled</key>
170 <false/>
171 <key>GroupName</key>
172 <string>appserverusr</string>
173 <key>Label</key>
174 <string>com.apple.webobjects.womonitor</string>
175 <key>OnDemand</key>
176 <false/>
177 <key>Program</key>
178 <string>/System/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor</string>
179 <key>ProgramArguments</key>
180 <array>
181 <string>JavaMonitor</string>
182 <string>-WOPort</string>
183 <string>56789</string>
184 </array>
185 <key>ServiceIPC</key>
186 <false/>
187 <key>UserName</key>
188 <string>appserver</string>
189 </dict>
190 </plist>
191
192 {{/code}}
193
194 Start the launchd daemons :
David Holt 31.1 195 (you may need to sudo here)
Gavin Eadie 23.1 196
197 {{code}}
198
199 launchctl load /Library/LaunchDaemons/com.apple.webobjects.wotaskd.plist
200 launchctl load /Library/LaunchDaemons/com.apple.webobjects.womonitor.plist
201
202 {{/code}}
203
David Holt 31.1 204 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:
Gavin Eadie 23.1 205
206 {{code}}
207
208 http://localhost:56789
209
210 {{/code}}
David Holt 43.1 211
212 = Developing with both WebObjects 5.4 and 5.3 =
213
214 (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):
215
216 Make a ///System/Library/Frameworks/WebObjects54// folder, and move the following frameworks from the 5.4 install into it:
217
218 {{code}}
219
220 JavaDTWGeneration.framework
221 JavaDirectToWeb.framework
222 JavaEOAccess.framework
223 JavaEOApplication.framework
224 JavaEOControl.framework
225 JavaEODistribution.framework
226 JavaEOGeneration.framework
227 JavaEOInterface.framework
228 JavaEOInterfaceCocoa.framework
229 JavaEOInterfaceSwing.framework
230 JavaEOProject.framework
231 JavaEORuleSystem.framework
232 JavaEOTool.framework
233 JavaFoundation.framework
234 JavaJDBCAdaptor.framework
235 JavaJNDIAdaptor.framework
236 JavaWOExtensions.framework
237 JavaWOJSPServlet.framework
238 JavaWebObjects.framework
239 JavaWebServicesClient.framework
240 JavaWebServicesGeneration.framework
241 JavaWebServicesSupport.framework
242 JavaXML.framework
243
244 {{/code}}
245
246 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)
247
248 {{code}}
249
250 JavaDTWGeneration.framework
251 JavaDirectToWeb.framework
252 JavaEOAccess.framework
253 JavaEOApplication.framework
254 JavaEOCocoa.framework
255 JavaEOControl.framework
256 JavaEODistribution.framework
257 JavaEOGeneration.framework
258 JavaEOInterface.framework
259 JavaEOInterfaceCocoa.framework
260 JavaEOInterfaceSwing.framework
261 JavaEOProject.framework
262 JavaEORuleSystem.framework
263 JavaEOTool.framework
264 JavaFoundation.framework
265 JavaJDBCAdaptor.framework
266 JavaJNDIAdaptor.framework
267 JavaWOExtensions.framework
268 JavaWOJSPServlet.framework
269 JavaWebObjects.framework
270 JavaWebServicesClient.framework
271 JavaWebServicesGeneration.framework
272 JavaWebServicesSupport.framework
273 JavaXML.framework
274
275 {{/code}}
276
277 I then use the following two scripts to be able to switch between using 5.3 and 5.4 system wide:
278
279 {{code}}
280
281 bash-3.2# cat wo53
282 for framework in `ls /System/Library/Frameworks/WebObjects53`; do rm /System/Library/Frameworks/$framework; \
283 ln -sf /System/Library/Frameworks/WebObjects53/$framework /System/Library/Frameworks/$framework; done
284 bash-3.2# cat wo54
285 for framework in `ls /System/Library/Frameworks/WebObjects54`; do rm /System/Library/Frameworks/$framework; \
286 ln -sf /System/Library/Frameworks/WebObjects54/$framework /System/Library/Frameworks/$framework; done
287
288 {{/code}}
289
290 At this point, you should have NO WO frameworks in /System/Library/Frameworks they should be in subfolders.
291
292 Now go ahead and run wo53, which should now give you WO 5.3 framework symlinks.
293
294 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.
295
296 == Alternative 5.3 / 5.4 development method ==
297
298 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.,,
299
300 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__##,,
301
302 Then run it like this:
303
304 {{noformat}}
305
306 # ./woswitch.sh 53
307
308 {{/noformat}}
309
310 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.
311
312 To switch between the two runtimes, quit WOLips and run
313
314 {{noformat}}
315
316 # ./woswitch.sh 54
317 or
318 # ./woswitch.sh 53
319
320 {{/noformat}}
321
322 Then run WOLips again.
323
324 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##.
325
326 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 ##NEXT//ROOT//##// appropriately.//