← servoy magazine

[Tips] Running Servoy Developer on Port 80

  • Tips

If you have your Servoy Server tunneling on port 80 instead of the default 8080 port, you can get into situations where developing on port 80 is helpful. For example, I have a task that entails sending an html email out (content processed with the Velocity plugin), email has a link to a headless client jsp page, and the jsp page loads up a webclient in an iframe if certain conditions are met—at which point webclient handles all further user interaction.

To make this all work, a number of places have url links:

  • css images
  • jsp css file link
  • jsp iframe link to web client
  • velocity template response link

These links will be quite different on the server than they are on my development machine. And seeing as I already have enough pieces to keep track of, remembering to change these links each time I push to the server is a major hassle.

The solution involves modifying my local "/etc/hosts" ("c:\windows\system32\drivers\etc\hosts" on windows) file to trap for the server URL and point it back to my localhost, setting up URL rewrites in Servoy's Tomcat server (a tip for another day), and finally running Servoy Developer on port 80. This allows my development machine to use the same links as the live server uses.

To run Servoy Developer on port 80, go to "Preferences > Servoy > Services" pane, change the http port and restart.

[image unavailable: Picture 4]
At this point, if you go localhost in a web browser nothing comes up. This is because most operating systems don't allow processes below port 1024 to run unless started from the root (or administrator) user. And when you start Servoy Developer normally you are generally not the root user.

To run Servoy Developer as root, open up Terminal and run the following command and type in your password at the prompt:

sudo /Applications/Servoy/developer/Servoy.app/Contents/MacOS/servoy

On a PC you can just shift-right-click and say "run as administrator".

(It may be advantageous to run developer from root even if you are on the default port as the terminal window shows all the logging activity Servoy generates as you move around your solution.)

If localhost still doesn't work in a browser, turn off any other servers that maybe on port 80 already. For example, on a Mac turn web sharing off.