Why is jboss.socket.binding.port-offset system property not set in domain mode

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Issue

  • System.getProperty("jboss.socket.binding.port-offset") returns null. Is this expected? We would expect the offset defaults to 0 if not set.
  • Can we use -Djboss.socket.binding.port-offset system property in domain mode?
  • How to start two domain controllers on same machine by using -Djboss.socket.binding.port-offset.

Resolution

  • When user starts JBoss in domain mode, it does not set that property for each of the server instances. In standalone mode, JBoss will use that environment variable if set to adjust the port-offset, but it does not set it itself.

  • Hence, user can not use -Djboss.socket.binding.port-offset system property in domain mode. The -Djboss.socket.binding.port-offset system property can be used only in standalone mode.

  • To check whether JBoss uses/ignores -Djboss.socket.binding.port-offset=100 option or not try below testing.

  • Start the JBoss with/without -Djboss.socket.binding.port-offset=100 as following

First try with -Djboss.socket.binding.port-offset=100

[atayade@atayade bin]$ ./domain.sh -Djboss.socket.binding.port-offset=100

Then try netstat command to see which ports are being used by JBoss

[atayade@atayade bin]$ netstat -tnlp

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 127.0.0.1:8230              0.0.0.0:*                   LISTEN      13943/java          
tcp        0      0 127.0.0.1:9990              0.0.0.0:*                   LISTEN      13865/java          
tcp        0      0 127.0.0.1:3528              0.0.0.0:*                   LISTEN      13923/java          
tcp        0      0 127.0.0.1:5455              0.0.0.0:*                   LISTEN      13923/java          
tcp        0      0 127.0.0.1:9999              0.0.0.0:*                   LISTEN      13865/java          
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      -                   
tcp        0      0 127.0.0.1:8080              0.0.0.0:*                   LISTEN      13923/java          
tcp        0      0 127.0.0.1:4597              0.0.0.0:*                   LISTEN      13943/java          
tcp        0      0 10.10.10.10:53            0.0.0.0:*                   LISTEN      -                   
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      -                   
tcp        0      0 0.0.0.0:32023               0.0.0.0:*                   LISTEN      -                   
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      -                   
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      -                   
tcp        0      0 127.0.0.1:55002             0.0.0.0:*                   LISTEN      13848/java          
tcp        0      0 127.0.0.1:5595              0.0.0.0:*                   LISTEN      13943/java          
tcp        0      0 127.0.0.1:3678              0.0.0.0:*                   LISTEN      13943/java          
tcp        0      0 127.0.0.1:4447              0.0.0.0:*                   LISTEN      13923/java          
tcp        0      0 127.0.0.1:5605              0.0.0.0:*                   LISTEN      13943/java          
tcp        0      0 127.0.0.1:5445              0.0.0.0:*                   LISTEN      13923/java          
tcp        0      0 0.0.0.0:47589               0.0.0.0:*                   LISTEN      -                   
tcp        0      0 :::111                      :::*                        LISTEN      -                   
tcp        0      0 :::22                       :::*                        LISTEN      -                   
tcp        0      0 ::1:631                     :::*                        LISTEN      -                   
tcp        0      0 :::33025    
                :::*                        LISTEN      -  

Second try without -Djboss.socket.binding.port-offset=100

[atayade@atayade bin]$ ./domain.sh 

Then try netstat command to see which ports are being used by JBoss

[atayade@atayade bin]$ netstat -tnlp

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 127.0.0.1:8230              0.0.0.0:*                   LISTEN      14466/java          
tcp        0      0 127.0.0.1:9990              0.0.0.0:*                   LISTEN      14389/java          
tcp        0      0 127.0.0.1:3528              0.0.0.0:*                   LISTEN      14446/java          
tcp        0      0 127.0.0.1:5455              0.0.0.0:*                   LISTEN      14446/java          
tcp        0      0 127.0.0.1:9999              0.0.0.0:*                   LISTEN      14389/java          
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      -                   
tcp        0      0 127.0.0.1:8080              0.0.0.0:*                   LISTEN      14446/java          
tcp        0      0 127.0.0.1:4597              0.0.0.0:*                   LISTEN      14466/java          
tcp        0      0 10.10.10.10:53            0.0.0.0:*                   LISTEN      -                   
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      -                   
tcp        0      0 0.0.0.0:32023               0.0.0.0:*                   LISTEN      -                   
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      -                   
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      -                   
tcp        0      0 127.0.0.1:5595              0.0.0.0:*                   LISTEN      14466/java          
tcp        0      0 127.0.0.1:3678              0.0.0.0:*                   LISTEN      14466/java          
tcp        0      0 127.0.0.1:4447              0.0.0.0:*                   LISTEN      14446/java          
tcp        0      0 127.0.0.1:49376             0.0.0.0:*                   LISTEN      14372/java          
tcp        0      0 127.0.0.1:5605              0.0.0.0:*                   LISTEN      14466/java          
tcp        0      0 127.0.0.1:5445              0.0.0.0:*                   LISTEN      14446/java          
tcp        0      0 0.0.0.0:47589               0.0.0.0:*                   LISTEN      -                   
tcp        0      0 :::111                      :::*                        LISTEN      -                   
tcp        0      0 :::22                       :::*                        LISTEN      -                   
tcp        0      0 ::1:631                     :::*                        LISTEN      -                   
tcp        0      0 :::33025                    :::*                        LISTEN      -                   
  • In both scenario, you can see that JBoss uses same ports, i.e it proves that JBoss does not use -Djboss.socket.binding.port-offset=100 in domain mode.

  • So, then how to start two domain controller on same machine?

  • For this user would need to set system-property like below to start two domain controllers on same machine.

[atayade@atayade bin]$ ./domain.sh  -Djboss.management.http.port=10990  -Djboss.management.native.port=10999 --host-config=host-master.xml
[atayade@atayade bin]$ ./domain.sh  -Djboss.management.http.port=20990  -Djboss.management.native.port=20999 -host-config=host-master.xml

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments