Flexible GlassFish domain creation using --portbase
By alexismp on févr. 02, 2007
This blog has moved to alexismp.wordpress.com
Follow the link for the most up-to-date version of this blog entry.
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-domaincommand. 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 Instanceports. 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 --helpoutput:
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.