users@glassfish.java.net

Why does Glassfish 2.2.1 use these extra ports?

From: Ed Hillmann <ed.hillmann_at_gmail.com>
Date: Mon, 22 Mar 2010 08:53:17 +1000

Hi all. We're using Glassfish 2.2.1 to host a JSF application. As
part of our documentation, we've identified the ports that can be
passed to asadmin when a domain is created. From what we pieced
together, there are 8 ports: HTTP, ADMIN, ORB, HTTPS, JMS, SSL,
SSL_MUTUAL_AUTH, and JMX. In our development environment, each
developer has their own GF server on a linux server, and ports are
reserved for each developer. We're anticipating that multiple GF
servers will be installed in production environments as well, and our
doco has identified these 8 ports to be reserved for each instance.

We've noticed, however, that Glassfish uses up a lot more ports than
what's we've found documented. Using netstat, there's an additional
14 ports

tcp 0 0 *:httpsEHILLMAN2 *:*
     LISTEN ehillman 858680 6107/java
tcp 0 0 *:jmsEHILLMAN2 *:*
     LISTEN ehillman 857477 6107/java
tcp 0 0 *:sslEHILLMAN2 *:*
     LISTEN ehillman 857456 6107/java
tcp 0 0 *:40195 *:*
     LISTEN ehillman 857492 6107/java
tcp 0 0 *:40675 *:*
     LISTEN ehillman 857484 6107/java
tcp 0 0 *:sslmultiEHILLMAN2 *:*
     LISTEN ehillman 857457 6107/java
tcp 0 0 *:jmxEHILLMAN2 *:*
     LISTEN ehillman 857463 6107/java
tcp 0 0 *:42629 *:*
     LISTEN ehillman 857465 6107/java
tcp 0 0 localhost.localdomain:34738 *:*
     LISTEN ehillman 857440 6107/java
tcp 0 0 *:44854 *:*
     LISTEN ehillman 857482 6107/java
tcp 0 0 *:34104 *:*
     LISTEN ehillman 857488 6107/java
tcp 0 0 localhost6.l:x11-ssh-offset *:*
     LISTEN ehillman 756015 -
tcp 0 0 *:52603 *:*
     LISTEN ehillman 857489 6107/java
tcp 0 0 *:httpEHILLMAN2 *:*
     LISTEN ehillman 858661 6107/java
tcp 0 0 *:adminEHILLMAN2 *:*
     LISTEN ehillman 858683 6107/java
tcp 0 0 *:orbEHILLMAN2 *:*
     LISTEN ehillman 857453 6107/java
tcp 0 0 dingbat:42629 dingbat:18860
     ESTABLISHED ehillman 857466 6107/java
tcp 0 0 localhost.localdomain:35378
localhost.localdomain:34738 ESTABLISHED ehillman 857901
6107/java
tcp 0 0 dingbat:43496 dingbat:40675
     ESTABLISHED ehillman 857486 6107/java
tcp 0 0 dingbat:jmxEHILLMAN2 dingbat:51284
     ESTABLISHED ehillman 857468 6107/java
tcp 0 0 dingbat:40675 dingbat:43496
     ESTABLISHED ehillman 857485 6107/java
tcp 0 0 dingbat:jmxEHILLMAN2 dingbat:35657
     ESTABLISHED ehillman 857464 6107/java
tcp 0 0 dingbat:35657 dingbat:jmxEHILLMAN2
     ESTABLISHED ehillman 857467 6107/java
tcp 0 0 localhost.localdomain:34738
localhost.localdomain:35378 ESTABLISHED ehillman 857449
6107/java
tcp 0 0 dingbat:51284 dingbat:jmxEHILLMAN2
     ESTABLISHED ehillman 857474 6107/java
tcp 0 0 dingbat:18860 dingbat:42629
     ESTABLISHED ehillman 857469 6107/java

This makes it a total of 22 ports used just when the server is started
(there haven't been any connections).

The main problem for us is that Glassfish, when it uses one of these
additional ports, goes and finds the first available port. And, often
enough, it picks a port that's been reserver for another Glassfish
server, preventing it to start.

Does anyone know why all these ports are being used? We're running
this on Oracle Unbreakable Linux (Linux 2.6.18-128.el5). More
importantly, can Glassfish be configured to restrict itself to
specific ports when it needs one? It would be trivial for us to
reserve additional ports, if only we can construct the domain to use a
restricted set of ports.

Thanks for any info,
Ed