Version 60.1 by Kieran Kelleher on 2007/10/18 12:46

Show last authors
1 If you are accessing your application with URLs that look like [[http://localhost:45437/cgi-bin/WebObjects/AppName.woa/]] (with the xxx:portnum instead of xxxx/-portnum) ... then you are using the [[Evil Direct Connect>>Web Applications-Development-Direct Connect]]. See that [[page>>Web Applications-Development-Direct Connect]] for why you don't want to be using Direct Connect. See this page for how to stop.
2
3 = Turning on Apache =
4
5 Go to **System Preferences > Sharing > Services** and turn on **Personal Web Sharing** if it is not already on.
6
7 When you turn on your web server, Apache will listen on the network interfaces that were configured when it starts. If you change networks, you may need to manually restart apache. You can do this by either stopping and restarting Personal Web Sharing, or you can run "apachectl restart" from the commandline as the root user. Because this can get annoying if you are working on a laptop, or periodically using VPN's, there are a couple ways to make this process easier.
8
9 = Optional Extra Configuration: Explicitly Setting Your Hostname =
10
11 {{info title="Useful Information"}}
12
13 The changes in this section are only required if you want your hostname to be stable across network changes. While this simplifies many aspects of development (like testing cookies and https), it may cause problems with those specific aspects (cookies, https, etc.) if you need to be able to access your dev machine from a remote machine, including if you need to be able to test your web app from a Parallels VM.
14
15 Bonjour Delays: Apparently the procedure here is also useful for preventing "Bonjour" delays when you launch the browser to test your app on your development machine.
16
17 {{/info}}
18
19 == Edit Apache Config ==
20
21 {{warning title="Bonjour, comment ça va? .... Trés bien, merci!"}}
22
23 *Do NOT try to use the Bonjour / Rendezvous name of your machine in this step.* It will cause you grief. Accept this and don't even try. You have been warned.
24
25 {{/warning}}
26
27 Edit **/etc/httpd/httpd.conf**, find the line containing **ServerName** and change it to this:
28
29 {{code}}
30
31 ServerName localhost
32
33 {{/code}}
34
35 That line may be commented out by default. You can simply uncomment it (remove the leading pound sign) and then restart apache:
36
37 {{code}}
38
39 sudo apachectl restart
40
41 {{/code}}
42
43 == Tell the adaptor to use localhost ==
44
45 Edit **/System/Library/WebObjects/Adaptors/Apache/apache.conf** to make sure that your enabled/uncommented WebObjectsConfig property looks like this:
46
47 {{code}}
48
49 WebObjectsConfig http://localhost:1085 10
50
51 {{/code}}
52
53 == Tell wotaskd to Use Localhost Too ==
54
55 Edit **/System/Library/WebObjects/JavaApplications/wotaskd.woa/Contents/Resources/Properties**
56
57 Add this line after the **WOPort=1085** one:
58
59 {{code}}
60
61 WOHost=localhost
62
63 {{/code}}
64
65 Now you need to restart wotaskd:
66
67 {{code}}
68
69 sudo systemstarter stop "WebObjects Services"
70 sudo systemstarter start "WebObjects Services"
71
72 {{/code}}
73
74 or
75
76 restart wotaskd and womonitor with launchctl if your WebObjects install launches that way.
77
78 == Finally, Configure your Application ==
79
80 Add or edit these launch parameters:
81
82 {{code}}
83
84 -WODirectConnectEnabled false
85 -WOHost localhost
86 -WOAdaptorURL http://localhost/cgi-bin/WebObjects
87 -WOPort 5555
88
89 {{/code}}
90
91 The WOPort is optional, but useful if you want consistent URLs for bookmarks and such. You can use any number you want, but it needs to be unique for each application you launch (or rather, you can only run one app instance on a given WOPort at a time). In WOLips, WOPort, WODirectConnectEnabled, and WOAdaptorURL already exist and just need to be updated. WOHost does not, and needs to be added. The dash in front of the name ("-WOHost") is important and must be in the name for the setting to work properly.
92
93 You may want to set this in your global WOLips settings so you don't have to set it every time you make a new launch configuration. You will need to go back and modify existing launch configurations with these settings even if you set it globally. Global settings only apply to newly created launch configurations.
94
95 = Apache Restart =
96
97 {{info title="Why would I need this?"}}
98
99 If you have a laptop and you get an "Application cannot be found" or some such error in the browser after auto-switching networks (for example going from a work network to a home network), restarting apache can resolve the error condition most of the time. A script is shown below to do that.
100 If you already implemented the "localhost" explicit hostname setup above, then you will probably not need to bother with this section.
101
102 {{/info}}
103
104 == Making a restart script ==
105
106 Create a script named /usr/local/bin/restartApache and set the contents to:
107
108 {{code}}
109
110 #!/bin/bash
111 /usr/sbin/apachectl stop
112 sleep 1
113 /usr/sbin/apachectl start
114
115 {{/code}}