2 Replies Latest reply on Jul 15, 2004 4:39 AM by mfrost

    AttributeNotFoundException when using ServiceBinding to chan

    mfrost

      Hello,

      I am trying to use the ServiceBindingManager to change the mcast_addr setting. We use this service successfully to allow us to run more than 1 JBoss node on a machine but also want to do this so that we can run independent clusters. Ideally I only want 1 version of cluster-service.xml and use ServiceBinding to change the mcast_addr value.

      I am using the XSLTConfigDelegate to do this. I supply the cluster-service.xml extract along with my service-config.

      I get the following exception:

      14:25:25,678 INFO [MainDeployer] Starting deployment of package: file:/J:/3rdparty_javadev_vob/jboss/server/ro1/deploy/cluster-service.xml
      14:25:25,819 WARN [ServiceConfigurator] Failed to apply service binding override
      javax.management.AttributeNotFoundException: Readable attribute 'PartitionConfig' not found
       at org.jboss.mx.capability.ReflectedMBeanDispatcher.getAttribute(ReflectedMBeanDispatcher.java:136)
       at org.jboss.mx.server.MBeanServerImpl.getAttribute(MBeanServerImpl.java:453)
       at org.jboss.services.binding.XSLTConfigDelegate.applyConfig(XSLTConfigDelegate.java:73)
       at org.jboss.services.binding.ServiceBindingManager.applyServiceConfig(S
      


      It states that PartitionConfig is not readable.

      When I look at my DefaultPartition MBean through jmx-console it shows that PartitionConfig is WRITE-ONLY. Is there a reason for this? Could this be causing my problem?

      Many thanks in advance.

      Regards

      mark

      CLUSTER XML
       <!-- ==================================================================== -->
       <!-- Cluster Partition: defines cluster -->
       <!-- ==================================================================== -->
      
       <mbean code="org.jboss.ha.framework.server.ClusterPartition"
       name="jboss:service=DefaultPartition">
      
       <attribute name="PartitionConfig">
       <Config>
       <!-- UDP: if you have a multihomed machine,
       set the bind_addr attribute to the appropriate NIC IP address -->
       <!-- UDP: On Windows machines, because of the media sense feature
       being broken with multicast (even after disabling media sense)
       set the loopback attribute to true -->
       <!--<UDP mcast_addr="${uk.co.hemscott.UDP.mcast_addr}" mcast_port="45566" -->
       <UDP mcast_addr="228.1.2.5" mcast_port="45566"
       ip_ttl="64" ip_mcast="true"
       mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
       ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
       loopback="false" />
       <PING timeout="2000" num_initial_members="3"
       up_thread="true" down_thread="true" />
       <MERGE2 min_interval="5000" max_interval="10000" />
       <FD shun="true" up_thread="true" down_thread="true"
       timeout="2500" max_tries="5" />
       <VERIFY_SUSPECT timeout="3000" num_msgs="3"
       up_thread="true" down_thread="true" />
       <pbcast.NAKACK gc_lag="50" retransmit_timeout="300,600,1200,2400,4800"
       up_thread="true" down_thread="true" />
       <pbcast.STABLE desired_avg_gossip="20000"
       up_thread="true" down_thread="true" />
       <UNICAST timeout="5000" window_size="100" min_threshold="10"
       down_thread="true" />
       <FRAG frag_size="8192"
       down_thread="true" up_thread="true" />
       <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
       shun="true" print_local_addr="true" />
       <pbcast.STATE_TRANSFER up_thread="true" down_thread="true" />
       </Config>
       </attribute>
      
       <!-- Name of the partition being built -->
       <attribute name="PartitionName">DefaultPartition</attribute>
       <!-- Determine if deadlock detection is enabled -->
       <attribute name="DeadlockDetection">False</attribute>
       <!-- The JGroups protocol configuration -->
       </mbean>
      


      SERVICE BINDING XML
       <service-config name="jboss:service=DefaultPartition"
       delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
       >
       <delegate-config>
       <xslt-config configName="PartitionConfig"><![CDATA[
      <xsl:stylesheet
       xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
      
       <xsl:output method="xml" />
       <!--<xsl:param name="port"/>
      
       <xsl:variable name="portAJP" select="$port - 71"/>-->
      
       <xsl:template match="/">
       <xsl:apply-templates/>
       </xsl:template>
      
       <xsl:template match = "UDP">
       <UDP>
       <xsl:for-each select="@*">
       <xsl:choose>
       <xsl:when test="(name() = 'mcast_addr'">
       <!--<xsl:attribute name="mcast_addr"><xsl:value-of select="$port"/></xsl:attribute>-->
       <xsl:attribute name="mcast_addr">228.1.2.4</xsl:attribute>
       </xsl:when>
       <xsl:otherwise>
       <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
       </xsl:otherwise>
       </xsl:choose>
       </xsl:for-each>
       </UDP>
       </xsl:template>
      
       <xsl:template match="*|@*">
       <xsl:copy>
       <xsl:apply-templates select="@*|node()"/>
       </xsl:copy>
       </xsl:template>
      </xsl:stylesheet>
      ]]>
       </xslt-config>
       </delegate-config>
       <!--<binding port="8180" />-->
       </service-config>
      


        • 1. Re: AttributeNotFoundException when using ServiceBinding to
          mounikap

          hi Mark,

          I am facing same problem.Did you find a solution for this ?

          thanks in advance,
          Mounika.

          • 2. Re: AttributeNotFoundException when using ServiceBinding to
            mfrost

            Hi Mounika,

            No sorry I have had no luck with this yet.

            My colleague has a theory on why some attributes are declared as write-only and I include details but this doesn't really get us closer to a solution.

            I may look into writing my own version of the class that deals with reading mbean XML-hopefully by just subclassing.

            Another alternative is to specify 2 deployment folders - the standard JBoss one and another one. We're already doing this here. We could then remove cluster-service.xml from the standard deploy folder and place a different cluster-service.xml file in the new deployment folder for each cluster i.e. with a different mcast_addr.

            For example:

            CLUSTER 1:
            /root/jboss/server/all/deploy
            /cluster1/deploy/cluster_service.xml - mcast_addr X

            CLUSTER 2:
            /root/jboss/server/all/deploy
            /cluster2/deploy/cluster_service.xml - mcast_addr Y

            Meantime I'm unfortunately working on something else so please let me know if you have any luck.

            Regards

            Mark

            Write-only attribute theory...


            I think i've worked out why that attirbute you found was write only... there is a case where that is the only way to solve a particular problem. Basically if an attribute is an object, then unless that object has a 'fromString' constructor then then jmx-console will error if the attribute is declared as readable.

            Ive has to use a write-only attribute for the caches attribute on the main cacheManagement bean... here is my comment...

            <!-- property has to be write only, since it can only be written using a legitimate object ArrayList. the jmx-console will
            call the getter method (which will return a string form of the ArrayList), but then when any attribute is changed it will
            call the setter methods of ALL attributes that were read and displayed. However, the jmx-console has no idea how
            to convert the string version of the array list back into an array list object to call the setter with - hence it would
            error. The only way around this is to declare the proprty write-only which means the depends-list stuff in the jboss-service.xml
            file can correctly set up the pointers to the other MBeans that represent the caches, but the jmx-console cannot read the
            attribute and hence does not attempt to set it using a string version -->
            <attribute access="write-only" getMethod="getCaches" setMethod="setCaches">
            <description>List of XmlData caches</description>
            <name>Caches</name>
            <type>java.util.ArrayList</type>
            </attribute>

            Cheers
            Bart