6 Replies Latest reply on Jun 17, 2013 6:00 AM by erasmomarciano

    Using place-holder in the "standalone-ha.xml" (Jboss AS7)

    thomas2008ch

      Hi,

       

      I use the tcp-clustering and in the standalone-ha.xml one can define this as follow:

       

      [code]

      ...

                  <stack name="tcp">

                      <transport socket-binding="jgroups-tcp" type="TCP"/>

                      <protocol type="TCPPING">

                          <property name="initial_hosts">

                              172.23.17.41[7600],172.23.17.43[7600]

                          </property>

      ...

      [/code]

       

      Since I don't want to hard coding the IP-Address in the file, I use the place holder such as follow:

       

      [code]

      ...

                  <stack name="tcp">

                      <transport socket-binding="jgroups-tcp" type="TCP"/>

                      <protocol type="TCPPING">

                          <property name="initial_hosts">

                              ${tcp.initial_hosts}

      ...

      [/code]

       

      And in a properties file I define the place holder as follow:

       

      [code]

      ...

      tcp.initial_hosts=172.23.17.41[7600],172.23.17.43[7600]

      ...

      /[code]

       

      But as I start the Jboss I got error in server.log:

      [code]

      ...

      09:14:22,680 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 54) MSC000001: Failed to start service jboss.jgroups.channel.web: org.jboss.msc.service.StartException in service jboss.jgroups.channel.web: java.lang.Exception: String value could not be converted for method initial_hosts in TCPPING with default value ${tcp.initial_hosts}.Exception is java.lang.Exception: Conversion of initial_hosts in TCPPING with original property value ${tcp.initial_hosts} failed

              at org.jboss.as.clustering.jgroups.subsystem.ChannelService.start(ChannelService.java:51)

              at org.jboss.as.clustering.msc.AsynchronousService$1.run(AsynchronousService.java:82) [jboss-as-clustering-common.jar:7.1.3.Final-redhat-4]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]

              at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]

              at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads.jar:2.0.0.GA-redhat-2]

      Caused by: java.lang.Exception: String value could not be converted for method initial_hosts in TCPPING with default value ${tcp.initial_hosts}.Exception is java.lang.Exception: Conversion of initial_hosts in TCPPING with original property value ${tcp.initial_hosts} failed

              at org.jgroups.stack.Configurator.createInetAddressMap(Configurator.java:697)

              at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:94)

              at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:55)

              at org.jgroups.stack.ProtocolStack.setup(ProtocolStack.java:465)

              at org.jgroups.JChannel.init(JChannel.java:795)

              at org.jgroups.JChannel.<init>(JChannel.java:166)

              at org.jboss.as.clustering.jgroups.MuxChannel.<init>(MuxChannel.java:37)

              at org.jboss.as.clustering.jgroups.JChannelFactory.createChannel(JChannelFactory.java:78)

              at org.jboss.as.clustering.jgroups.subsystem.ChannelService.start(ChannelService.java:44)

              ... 5 more

      Caused by: java.lang.Exception: Conversion of initial_hosts in TCPPING with original property value ${tcp.initial_hosts} failed

              at org.jgroups.conf.PropertyHelper.getConvertedValue(PropertyHelper.java:85)

              at org.jgroups.stack.Configurator.createInetAddressMap(Configurator.java:694)

              ... 13 more

      Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

              at java.lang.String.substring(String.java:1911) [rt.jar:1.7.0_17]

              at org.jgroups.util.Util.parseCommaDelimitedHosts(Util.java:2799)

              at org.jgroups.conf.PropertyConverters$InitialHosts.convert(PropertyConverters.java:65)

              at org.jgroups.conf.PropertyHelper.getConvertedValue(PropertyHelper.java:82)

              ... 14 more

      ...

      [/code]

       

      How can I fix it?

        • 1. Re: Using place-holder in the "standalone-ha.xml" (Jboss AS7)
          erasmomarciano

          Hi

          Perhaps there is a bug in JBoss

           

          check this url

           

          https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=900707

           

          Try to use last version of Jboss

          • 2. Re: Using place-holder in the "standalone-ha.xml" (Jboss AS7)
            thomas2008ch

            I am not sure if this is a bug and could be solved in the latest version. In my standalone.xml I use else where place-holder such as:

             

            [code]

            ...

                <interfaces>

                    <interface name="management">

                        <inet-address value="${jboss.bind.address}"/>

                    </interface>

            ...

            [/code]

             

            In the properties file:

            [code]

            ...

            jboss.bind.address=123.345.456.101

            ...

            [/code]

             

             

            and this works.

            • 3. Re: Using place-holder in the "standalone-ha.xml" (Jboss AS7)
              wdfink

              Hi

              the placeholders must be evaluated by the subsystem.

              You might use the interactive CLI and check whether this attribute supports expressions.

              • 4. Re: Using place-holder in the "standalone-ha.xml" (Jboss AS7)
                erasmomarciano

                Interesting

                How I can see con JbossCli this parameter?

                 

                /profile=ha/subsystem=jgroups/stack=tcp/

                • 5. Re: Using place-holder in the "standalone-ha.xml" (Jboss AS7)
                  jaikiran

                  The read-resource-description operation on a resource shows whether or not a particular attribute of a resource supports expressions. For example, the read-resource-description of ejb3 subsystem shows this for security-domain attribute;

                   

                  [standalone@localhost:9990 /] /subsystem=ejb3:read-resource-description 
                  {
                      "outcome" => "success",
                      "result" => {
                          "description" => "The configuration of the ejb3 subsystem.",
                          "attributes" => {
                              "default-security-domain" => {
                                  "type" => STRING,
                                  "description" => "The default security domain that will be used for EJBs if the bean doesn't explicitly specify one",
                                  "expressions-allowed" => true,
                  

                   

                  See the expressions-allowed value in that output.

                  • 6. Re: Using place-holder in the "standalone-ha.xml" (Jboss AS7)
                    erasmomarciano

                    Perhaps you can not use supports expressions.

                     

                    I simulated your scenary

                     

                    I  add ed a new stack=tcperasmo

                     

                    <stack name="tcperasmo">

                                        <transport type="TCP" socket-binding="jgroups-tcp" diagnostics-socket-binding="jgroups-diagnostics"/>

                                         <protocol type="TCPPING">

                                                <property name="initial_hosts">

                                                    172.23.17.41[7600],172.23.17.43[7600]

                                               </property>

                                           </protocol>   

                     

                                        <protocol type="MERGE2"/>

                                        <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>

                                        <protocol type="FD"/>

                                        <protocol type="VERIFY_SUSPECT"/>

                                        <protocol type="BARRIER"/>

                                        <protocol type="pbcast.NAKACK"/>

                                        <protocol type="UNICAST2"/>

                                        <protocol type="pbcast.STABLE"/>

                                        <protocol type="pbcast.GMS"/>

                                        <protocol type="UFC"/>

                                        <protocol type="MFC"/>

                                        <protocol type="FRAG2"/>

                                    </stack>

                     

                    I have check with Jboss-Cli for to see if exits the attribute "expressions-allowed"

                     

                    as you can see as following:

                     

                    domain@localhost:9999 stack=tcperasmo] :read-resource(recursive=true)

                    {

                        "outcome" => "success",

                        "result" => {

                            "protocols" => [

                                "TCPPING",

                                "MERGE2",

                                "FD_SOCK",

                                "FD",

                                "VERIFY_SUSPECT",

                                "BARRIER",

                                "pbcast.NAKACK",

                                "UNICAST2",

                                "pbcast.STABLE",

                                "pbcast.GMS",

                                "UFC",

                                "MFC",

                                "FRAG2"

                            ],

                            "protocol" => {

                                "FRAG2" => {

                                    "property" => undefined,

                                    "socket-binding" => undefined,

                                    "type" => "FRAG2"

                                },

                                "FD_SOCK" => {

                                    "property" => undefined,

                                    "socket-binding" => "jgroups-tcp-fd",

                                    "type" => "FD_SOCK"

                                },

                                "FD" => {

                                    "property" => undefined,

                                    "socket-binding" => undefined,

                                    "type" => "FD"

                                },

                                "TCPPING" => {

                                    "socket-binding" => undefined,

                                    "type" => "TCPPING",

                                    "property" => {"initial_hosts" => {"value" => "172.23.17.41[7600],172.23.17.43[7600]"}}

                                },

                                "pbcast.GMS" => {

                                    "property" => undefined,

                                    "socket-binding" => undefined,

                                    "type" => "pbcast.GMS"

                                },

                                "BARRIER" => {

                                    "property" => undefined,

                                    "socket-binding" => undefined,

                                    "type" => "BARRIER"

                                },

                                "pbcast.NAKACK" => {

                                    "property" => undefined,

                                    "socket-binding" => undefined,

                                    "type" => "pbcast.NAKACK"

                                },

                                "MFC" => {

                                    "property" => undefined,

                                    "socket-binding" => undefined,

                                    "type" => "MFC"

                                },

                                "UNICAST2" => {

                                    "property" => undefined,

                                    "socket-binding" => undefined,

                                    "type" => "UNICAST2"

                                },

                                "VERIFY_SUSPECT" => {

                                    "property" => undefined,

                                    "socket-binding" => undefined,

                                    "type" => "VERIFY_SUSPECT"

                                },

                                "UFC" => {

                                    "property" => undefined,

                                    "socket-binding" => undefined,

                                    "type" => "UFC"

                                },

                                "pbcast.STABLE" => {

                                    "property" => undefined,

                                    "socket-binding" => undefined,

                                    "type" => "pbcast.STABLE"

                                },

                                "MERGE2" => {

                                    "property" => undefined,

                                    "socket-binding" => undefined,

                                    "type" => "MERGE2"

                                }

                            },

                            "transport" => {"TRANSPORT" => {

                                "default-executor" => undefined,

                                "diagnostics-socket-binding" => "jgroups-diagnostics",

                                "machine" => undefined,

                                "oob-executor" => undefined,

                                "property" => undefined,

                                "rack" => undefined,

                                "shared" => true,

                                "site" => undefined,

                                "socket-binding" => "jgroups-tcp",

                                "thread-factory" => undefined,

                                "timer-executor" => undefined,

                                "type" => "TCP"

                            }}

                        }

                    }

                     

                     

                     

                    OR

                     

                     

                    domain@localhost:9999 stack=tcperasmo] :read-resource-description

                    {

                        "outcome" => "success",

                        "result" => {

                            "description" => "The configuration of a jgroups protocol stack.",

                            "children" => {

                                "transport" => {

                                    "description" => "The configuration of a transport for a protocol stack.",

                                    "min-occurs" => 0,

                                    "max-occurs" => 1,

                                    "allowed" => ["TRANSPORT"],

                                    "model-description" => undefined

                                },

                                "protocol" => {

                                    "description" => "The configuration of a protocol within a protocol stack.",

                                    "min-occurs" => 0,

                                    "max-occurs" => 2147483647,

                                    "model-description" => undefined

                                }

                            }

                        }

                    }

                     

                     

                    The attribute "expressions-allowed" is not present