1 2 Previous Next 27 Replies Latest reply on Sep 20, 2012 9:49 AM by chaudharygaurav

    JBoss 5.1.0 GA random ports issue !

    chaudharygaurav

      Hi !

       

      I just noticed that JBoss opens some random ports when it is started like the below

        TCP    127.0.0.1:49354        0.0.0.0:0              LISTENING       4860

      [java.exe]

        TCP    127.0.0.1:49356        127.0.0.1:49357        ESTABLISHED     4860

      [java.exe]

        TCP    127.0.0.1:49357        127.0.0.1:49356        ESTABLISHED     4860

      [java.exe]

        TCP    127.0.0.1:49358        127.0.0.1:49359        ESTABLISHED     4860

      [java.exe]

        TCP    127.0.0.1:49359        127.0.0.1:49358        ESTABLISHED     4860

      [java.exe]

        TCP    127.0.0.1:49360        127.0.0.1:49361        ESTABLISHED     4860

      [java.exe]

        TCP    127.0.0.1:49361        127.0.0.1:49360        ESTABLISHED     4860

      [java.exe]

        TCP    127.0.0.1:49362        127.0.0.1:31443        ESTABLISHED     4860

      [java.exe]

        TCP    127.0.0.1:49363        127.0.0.1:49364        ESTABLISHED     4860

      [java.exe]

        TCP    127.0.0.1:49364        127.0.0.1:49363        ESTABLISHED     4860

      [java.exe]

       

      Can anybody please tell me why is it so? These port numbers change everytime I restart the JBoss...

       

      Thanks in Advance:)

        • 1. JBoss 5.1.0 GA random ports issue !
          wdfink

          JBoss use different ports, e.g. for internal cluster communication or JMS, these ports are not configured and a free port will be used every restart.

          Some ports are configured within jboss-service.xml (or others) and set to '0' which is the indicator for 'use a free port', in this case you might configure a fix port number.

          • 2. JBoss 5.1.0 GA random ports issue !
            chaudharygaurav

            Thanks for the reply.

             

            Is there any way to know from where a particular port was opened? I tried doing Trace but didn't see anything related in the logs...

            • 3. JBoss 5.1.0 GA random ports issue !
              wdfink

              A bunch of ports are opened by JGroups to communicate within the cluster, you will find it via jmx-console section jboss.jgroups.

              AFAIK only a JMS port is opened with a random number for temporary client-server communication.

               

              But I'm not sure whether that is all.

              • 4. JBoss 5.1.0 GA random ports issue !
                chaudharygaurav

                Hi ! Thanks for the reply. The problem over here is that we need to install the JBoss on a customer site and the customer only unblocks the ports on the request basis. I tried chaging the jboss service xml as well but it only makes 1-2 ports static and others still remain random which is a problem with us.

                Any workaround???

                • 5. JBoss 5.1.0 GA random ports issue !
                  wdfink

                  Do you have the firewall between two JBoss instances which run in a cluster? Hopefully not, I think that is very difficult or unless impossible.

                   

                  If the server (farm) is behind a firewall, you find helpful hints here:

                  http://community.jboss.org/wiki/UsingJBossBehindAFirewall

                   

                  If you have still questions you should post what services you use which are not working, what ports you configured within the firewall.

                  So it is easier two answer specific for the community.

                  • 6. Re: JBoss 5.1.0 GA random ports issue !
                    chaudharygaurav

                    Hi !

                     

                    There is only one jboss instance.  We are not using in the cluster.

                     

                    Also these are the ports that are already opened....

                     

                    8080
                    1098
                    1090
                    4713
                    1099
                    4712
                    4457
                    4446
                    31000
                    35432
                    31443
                    4445
                    4444
                    8083
                    3873
                    8009
                    10081 -> Port opened by our application.

                     

                    Now, when we block other ports, JBoss does not stay up and goes down with attached error...

                     

                    What I want to know is if there is any way so we know why this port is opened and if this can be blocked, or if we can specify some range to the random ports that are opened by the jboss...

                     

                    • 7. JBoss 5.1.0 GA random ports issue !
                      wdfink

                      If you have only one JBoss it should start on any system behind a firewall.

                      The 'java.io.IOException: Can not find a free port for use.' is a local problem that I don't understand ATM.

                       

                      Do you check that a unchanged JBoss start correct after you unpack it?

                      How do you start the JBoss, please post command line?

                      What OS you use?

                       

                      If the fresh JBoss didn't start without error please set the category 'org.jboss.remoting' to TRACE within the .../server/<server-conf>/conf/jboss-log4j.xml.

                      After startt you should attach the server.log and boot.log

                      • 8. Re: JBoss 5.1.0 GA random ports issue !
                        chaudharygaurav

                        We are using z/OS 1.12 to run JBoss. Now on this system, no application can open any port on its own other than the ports specified by the admin. See list above in my previous message. Also, there are no firewall issues on this system.

                         

                        We are in the process of downloading the fresh JBoss with Teiid and will try to run it and get back to you with updates on it.

                         

                        The command line that we use for starting the JBoss is

                        "+D org.jboss.Main -b <localhost>"

                        • 9. JBoss 5.1.0 GA random ports issue !
                          wdfink

                          I'm not sure, but I suppose that not all JBoss ports can be set to a fixed port number because some are used for internal communication.

                           

                          You should use the http://community.jboss.org/wiki/JBoss5xTuningSlimming wiki to remove all services (including cluster) from the JBoss to reduce the used ports.

                          Other option might be a virtual IP address where all ports are free.

                          • 10. Re: JBoss 5.1.0 GA random ports issue !
                            chaudharygaurav

                            Hi ! I checked yesterday and there are random ports to the tune of 36 that are opened and because of which, we just cannot install our application on customer system.

                            May be we can try taking the minimal JBoss and adding Teiid to it. Can you please tell me the dependencies required for Teiid and what all modules I need to add to JBoss to support Teiid. If there is any documentation for it, it will help us immensly...

                             

                            Thanks

                            • 11. Re: JBoss 5.1.0 GA random ports issue !
                              chaudharygaurav

                              Hi !

                               

                              We again tried this on a z/OS system where 60 ports were opened and it still gives the error

                              java.io.IOException: Can not find a free port for use.

                               

                              We at present, just need to determine the max ports to open for running JBoss on a mainframe. This is because we install our application on a restricted environment where customer will open only the number of ports that we ask for. Now, for this, we opened 16 ports that we knew of and opened 45 ports extra to take care of the random ports that get opened by the JBoss internally.

                               

                              Can you please take a look at that? I have attached the boot.log and the server log...

                              • 12. Re: JBoss 5.1.0 GA random ports issue !
                                chaudharygaurav

                                We also tried this by opening 1000 random ports for the JBoss...still JBoss dies with the previous error...

                                 

                                Has anybody tried running JBoss on port restricted environment before?

                                • 13. Re: JBoss 5.1.0 GA random ports issue !
                                  rajeshharan

                                  Hi Gaurav,

                                   

                                  Did your issue get resolved? I'm getting same issue, where Jboss opens 3 random ports everytime the server is started. Is there anyway I can restrict those ports to a defined port range?

                                  Thanks, Rajesh. jboss.gif

                                  • 14. Re: JBoss 5.1.0 GA random ports issue !
                                    wdfink

                                    What profile you use?

                                    i.e. JGroups use random ports for cluster communication.

                                    Such ports should be open for internal communication and not opened for a firewall.

                                    1 2 Previous Next