One nice thing about GlassFish is the notion of a domain. A single installation can have multiple domains, each being created with the
asadmin create-domain command. I use that a lot to separate clients and servers when using web services for instance. If you’re not using Solaris Containers/Zones which have their own set of ports, you have to have different port settings for each domain. Default ports for GlassFish are as follows:
When creating a new domain, I usually always start the other domains I’d like to see running at the same time and specify new
HTTP Instance ports. The reason for starting first other domains is to make sure the new domain with not be created with any ports already in use (exact ports used are shown during domain creation).
The other option I recently found out about is
--portbase. This allows you to provide a base port and have other ports defined as offsets.
Taken straight from the
asadmin create-domain --help output:
Determines the number with which the port assignment
should start. A domain uses a certain number of ports
that are statically assigned. The portbase value
determines where the assignment should start. Choose
this value judiciously. The values for the ports are
calculated as follows: Admin port: portbase + 48, HTTP
listener port: portbase + 80, IIOP listener port:
portbase + 37, JMX port: portbase + 86. See the output
of this command for a complete list of occupied ports,
when --portbase option is specified.
The --portbase option cannot be used with the --
adminport or the --instanceport option.
Also note that when it comes to ports, GlassFish now also has this optionnal feature of unifying ports as described here.