8 Replies Latest reply on Apr 1, 2011 10:46 AM by beamerblvd

    changing ports require changes to 2 xml files

    mwringe

      I am using AS6 M2, and I am trying to change the default servlet port for the server, but this requires changes to two xml files.

       

      Lets say I want to run JBoss AS on 8085 instead of 8080, and I also want to use the ServiceBindingManager so I can switch it to 8185, 8285, etc

       

      I would have assumed that I could have just changed the 8080 value in port section of conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml to 8085. And then just use -Djboss.service.binding.set to change the values. But this doesn't work. In fact this breaks the service binding.

       

      If the port value in bindings-jboss-beans.xml is different from the value in server.xml, then the jboss service binding fails. In order for me to change it from 8080 to 8085 I need to change it in both files.


      If the files are so interdependent, shouldn't the bindings service just read the port from the service.xml?

        • 1. Re: changing ports require changes to 2 xml files
          jaikiran

          Changing only the binding-jboss-beans.xml should have worked. Can you post the exact changes you did and also what exceptions you see (i assume that's what you mean by the SBM breaking).

          • 2. Re: changing ports require changes to 2 xml files
            mwringe

            What I did is to replace 8080 in binding-jboss-beans.xml with 8085.

             

            start server, it starts on port 8080 and not 8085

            start server with -Djboss.service.binding.set=ports-01, server starts on port 8080 and not 8185

             

            There are no error exceptions or warnings about this in the logs, the server is just ignoring the jboss.service.binding.set=ports-01 and starting the server on 8080. This is what I mean by it breaking the service binding, that its no longer working and silently failing.

             

            change 8080 in server.xml to 8085

            start server, it starts on port 8085

            start server with -Djboss.service.binding.set=ports-01, the server starts on port 8185

             

            So when the port value is the same between the binding-jboss-beans.xml and server.xml then everything works, if the port value is different then the binding service doesn't work and silently fails.

            • 3. Re: changing ports require changes to 2 xml files
              jaikiran
              I just changed port number in the following section of JBOSS_HOME/server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml:
              {code:xml}
                          <bean class="org.jboss.services.binding.ServiceBindingMetadata">
                             <property name="serviceName">jboss.web:service=WebServer</property>
                             <property name="port">8080</property>
                             <property name="description">JBoss Web HTTP connector socket; also drives the values for the HTTPS and AJP sockets</property>
              
                             <!--
                                 Inject a XSLT transform configuration (see below) that describes
                                 how to transform server.xml
                                 If the binding value request doesn't require an XSL Transform, this config
                                 will be ignored.
                             -->
                             <property name="serviceBindingValueSourceConfig"><inject bean="JBossWebConnectorXSLTConfig"/></property>
                          </bean>
              {code}
              
              to 8380:
              
              {code:xml}
              <bean class="org.jboss.services.binding.ServiceBindingMetadata">
                             <property name="serviceName">jboss.web:service=WebServer</property>
                             <property name="port">8080</property>
                             <property name="description">JBoss Web HTTP connector socket; also drives the values for the HTTPS and AJP sockets</property>
              
                             <!--
                                 Inject a XSLT transform configuration (see below) that describes
                                 how to transform server.xml
                                 If the binding value request doesn't require an XSL Transform, this config
                                 will be ignored.
                             -->
                             <property name="serviceBindingValueSourceConfig"><inject bean="JBossWebConnectorXSLTConfig"/></property>
                          </bean>
              {code}
                          
              and started the server:
              
              {code}
              ./run.sh -b 0.0.0.0
              {code}
              
              {code}
              01:04:35,820 INFO  [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8380
              01:04:35,826 INFO  [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-0.0.0.0-8309
              {code}
              
              As shown in the logs it correctly picked up 8380 (without the need for changing any other file).
              
              Are you sure you changed the right file and the right section. Can you post the exact changes.          
              • 4. Re: changing ports require changes to 2 xml files
                jaikiran

                By the way, that output was from 6.0.0.M2, same as what you are using.

                • 5. Re: changing ports require changes to 2 xml files
                  mwringe

                  Ah, ok, if you edit the port in server.xml to be something other than 8080, and then the bindings doesn't work unless it is equals what is in binding-jboss-beans.xml

                  • 6. Re: changing ports require changes to 2 xml files
                    brian.stansberry

                    This problem will go away in M3. The whole XSL transform of server.xml has been removed; the ports in server.xml are now configured as system properties and the ServiceBindingManager ensures the properties are set. https://jira.jboss.org/jira/browse/JBAS-7466

                     

                    Thanks for the thread; I still had some minor qualms about this change (don't much like using system properties as a mechanism for passing data) but you remind me why I really dislike the XSLT approach!

                    • 7. Re: changing ports require changes to 2 xml files
                      beamerblvd

                      I hate to reopen an old (over a year old) and seemingly settled thread, but I'm using 6.0.0.FINAL and this doesn't appear to be working for me.

                       

                      I'm running two instances on the same machine. I want to run the HTTP and AJP connectors on adjacent ports, so I edit the server.xml files for node1 and node2 to look like this:

                       

                            <Connector protocol="HTTP/1.1" port="8101" address="0.0.0.0" />

                            <Connector protocol="AJP/1.3" port="20101" address="0.0.0.0" />

                       

                            <Connector protocol="HTTP/1.1" port="8102" address="0.0.0.0" />

                            <Connector protocol="AJP/1.3" port="20102" address="0.0.0.0" />

                       

                      I don't care what ports the other services run on, as long as they are different from each other. I tried starting node2 with -Djboss.service.binding.set=ports-01, but I got dozens of "Address in use" errors. So I edited node2/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml and changed ${jboss.service.binding.set:ports-default} to ${jboss.service.binding.set:ports-01}, but I still got dozens of "Address in use" errors. I'd rather not have to edit every port assignment in this file. I thought this was fixed? What do I do?

                       

                      Thanks!

                      • 8. Re: changing ports require changes to 2 xml files
                        beamerblvd

                        Also,

                         

                        Out of frustration, I went ahead and broke down and incremented all of the ports in the file manually. The instance starts, now, but it never joins the cluster. I have two instances on one machine and two instances on another machine. The two instances (one from each machine) that I didn't increment all of the ports manually join the cluster (you see it in the output of .\run.bat, but the other two instances (one from each machine) that I did increment the ports manually do not join the cluster. They just sit there waiting for connections.

                         

                        N