I’ve been trying to get GlassFish 4 to install on my laptop on and off for the past two days now. Needless to say, it’s not being going well. Initially I tried the native install (
export DISPLAY=localhost:0.0 btw 🙂 ), it hung trying to configure the domain. Trying to configure a new domain from the command line yielded:
./asadmin create-domain --adminport 4848 --instanceport 8000 domain2 You do not have permission to use port 4848 for domain2. Try a different port number or login to a more privileged account.
Nothing on port 4848 and even running the command as sudo root didn’t work. Next up, the zip install. The comes with a preconfigured domain and a new error trying to start it:
./asadmin start-domain domain1 There is a process already using the admin port of 4848 -- it probably is another instance of a GlassFish Server
Resorting to Google and I finally worked out that my hostname wasn’t in
/etc/hosts. Being on the work network I’ve been assigned a hostname by the DHCP server rather than the
sulaco.local it usually is. A quick google for setting the hostname on a Mac got me [this][http://blog.psyrendust.com/2008/05/23/change-the-hostname-in-mac-os-x-osx/] and I was able to run
sudo scutil --set HostName sulaco.local ./asadmin start-domain domain1
Lo and behold, GlassFish has started.