8 Replies Latest reply on Aug 24, 2009 2:07 PM by Brian Stansberry

    ServiceBindingSet

    Bob Damato Newbie

      I am trying to use the ServiceBindingSet with a port offset to run multiple instances of JBoss on the same machine. I want to control the HTTP port explicitly though. It looks like the "override" parameter is supposed to give me the ability to do this, but I can't seem to get it to work. Here is my service binding set below. When JBoss starts, I get HTTP listening on port 9100:

      13:29:10,087 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-myserver.mydomain.com%2F10.55.1.10-9100
      


       <bean name="Ports03Bindings" class="org.jboss.services.binding.impl.ServiceBindingSet">
       <constructor>
       <!-- The name of the set -->
       <parameter>ports-03</parameter>
       <!-- Default host name -->
       <parameter>${jboss.bind.address}</parameter>
       <!-- The port offset -->
       <parameter>400</parameter>
       <!-- Set of bindings to which the "offset by X" approach can't be applied -->
       <parameter>
       <set elementClass="org.jboss.services.binding.ServiceBindingMetadata">
       <bean class="org.jboss.services.binding.ServiceBindingMetadata">
       <property name="serviceName">jboss.web:service=WebServer</property>
       <property name="port">8700</property>
       <property name="description">JBoss Web HTTP connector socket; also drives the values for the HTTPS and AJP sockets
      </property>
       <property name="serviceBindingValueSourceConfig"><inject bean="JBossWebConnectorXSLTConfig"/></property>
       </bean>
       <bean class="org.jboss.services.binding.ServiceBindingMetadata">
       <property name="serviceName">jboss:service=Naming</property>
       <property name="bindingName">Port</property>
       <property name="port">1799</property>
       <property name="description">The listening socket for the Naming service</property>
       </bean>
       </set>
       </parameter>
       </constructor>
       </bean>
      


      Am I incorrect in my approach, or am I misunderstanding the concept?

      Thanks.

        • 1. Re: ServiceBindingSet
          Bob Damato Newbie

          Anyone have an idea?

          • 2. Re: ServiceBindingSet
            jaikiran pai Master

            Please provide more details. Which exact version of JBoss AS? And your log shows that its binding to 9100 which is not the default port that JBoss uses. Did you or someone change some configuration file which sets it to 9100. And how do you start the server? Do you pass the jboss.service.binding.set property to the run script?

            See this wiki for details on how to use the Service Binding Manager in AS-5 http://www.jboss.org/community/wiki/AS5ServiceBindingManager

            • 3. Re: ServiceBindingSet
              Bob Damato Newbie

              I'm running 5.1.0.GA on Solaris.

              I set the port to 8700 but it looks to me like the port offset (which in my case is set to 400) is even getting applied to the explicitly set ports. If I set the port to 8300, jBoss ends up starting the service on port 8700. I'm not sure if that's intended or a bug, but it's reproducible.

              • 4. Re: ServiceBindingSet
                jaikiran pai Master

                 

                "bdamato" wrote:
                I'm running 5.1.0.GA on Solaris.


                The file contents that you posted isn't what is shipped in AS-5.1.0.GA. Where did you find that file in the AS?

                "bdamato" wrote:

                I set the port to 8700 but it looks to me like the port offset (which in my case is set to 400) is even getting applied to the explicitly set ports. If I set the port to 8300, jBoss ends up starting the service on port 8700. I'm not sure if that's intended or a bug, but it's reproducible.

                If you don't want it to be offset, then why not use the "ports-default" and just change the HTTP port to whatever you want:

                <bean class="org.jboss.services.binding.ServiceBindingMetadata">
                 <property name="serviceName">jboss.web:service=WebServer</property>
                 <property name="port">8700</property>


                • 5. Re: ServiceBindingSet
                  jaikiran pai Master

                   

                  "jaikiran" wrote:


                  The file contents that you posted isn't what is shipped in AS-5.1.0.GA. Where did you find that file in the AS?


                  Wait a minute. After reading your post, i think you added that section in that file, after reading the comments mentioned there. Isn't it?

                  "bdamato" wrote:

                  I set the port to 8700 but it looks to me like the port offset (which in my case is set to 400) is even getting applied to the explicitly set ports. If I set the port to 8300, jBoss ends up starting the service on port 8700. I'm not sure if that's intended or a bug, but it's reproducible.


                  Let me see how it's expected to be configured.


                  • 6. Re: ServiceBindingSet
                    Brian Stansberry Master

                    This comment needs to be fixed:

                    <!-- Set of bindings to which the "offset by X" approach can't be applied -->


                    Should be something more like this:

                    <!-- Set of bindings that are specific to this ServiceBindingSet -->


                    https://jira.jboss.org/jira/browse/JBAS-7206

                    You then "fix" the port value (i.e. prevent the offset being applied) by setting the "fixedPort" property, same as you would for one of the elements in the StandardBindings set.

                     <bean name="Ports03Bindings" class="org.jboss.services.binding.impl.ServiceBindingSet">
                     <constructor>
                     <!-- The name of the set -->
                     <parameter>ports-03</parameter>
                     <!-- Default host name -->
                     <parameter>${jboss.bind.address}</parameter>
                     <!-- The port offset -->
                     <parameter>400</parameter>
                     <!-- Set of bindings to which the "offset by X" approach can't be applied -->
                     <parameter>
                     <set elementClass="org.jboss.services.binding.ServiceBindingMetadata">
                     <bean class="org.jboss.services.binding.ServiceBindingMetadata">
                     <property name="serviceName">jboss.web:service=WebServer</property>
                     <property name="port">8700</property>
                     <property name="description">JBoss Web HTTP connector socket; also drives the values for the HTTPS and AJP sockets
                    </property>
                     <property name="serviceBindingValueSourceConfig"><inject bean="JBossWebConnectorXSLTConfig"/></property>
                     <property name="fixedPort">true</property>
                     </bean>
                     <bean class="org.jboss.services.binding.ServiceBindingMetadata">
                     <property name="serviceName">jboss:service=Naming</property>
                     <property name="bindingName">Port</property>
                     <property name="port">1799</property>
                     <property name="description">The listening socket for the Naming service</property>
                     <property name="fixedPort">true</property>
                     </bean>
                     </set>
                     </parameter>
                     </constructor>
                     </bean>
                    



                    That's admittedly non-intuitive. The code is written such that the "fixedPort" property controls whether the offset is applied, no matter where the ServiceBindingMetadata comes from. That could be changed, but we'd need to add a mechanism to allow people to say fixedPort=false on an override binding. For example, make the field a Boolean with a null default and add a isFixedPortSet() getter.

                    • 7. Re: ServiceBindingSet
                      Bob Damato Newbie

                      That did the trick, thanks.

                      It might be worth showing an example of this in the wiki. I had to dig around just to figure out the format for that "override" parameter and it was just a wild guess that got me as far as I got.

                      • 8. Re: ServiceBindingSet
                        Brian Stansberry Master

                        Thanks for pointing that out. I just updated the wiki page to add more on this topic. But there's some problem going on with publishing the change, so it may be a while before the new content appears.