5 Replies Latest reply on Nov 13, 2007 9:21 PM by brian.stansberry

    Setting load-balance-policy

    brian.stansberry

      Been trying to sort out the setting of a clustered bean's load balance policy with the unified metadata. Simple test is to deploy the clusteredsession-test.jar from the ejb3 testsuite and see what happens. Always get this failure:

      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {http://www.jboss.com/x
      ml/ns/javaee}load-balance-policy not found as a child of {http://www.jboss.com/x
      ml/ns/javaee}cluster-config
       at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startE
      lement(SundayContentHandler.java:396)
       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHan
      dler.startElement(SaxJBossXBParser.java:407)
       at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour
      ce)
       at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Sourc
      e)
       at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
      own Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
      Dispatcher.dispatch(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
      known Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
       at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
       at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Sour ce)
       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBPars er.java:189)
       ... 27 more
      


      First obvious step was to add property loadBalancePolicy to ClusterConfigMetaData. Doesn't help.

      Tricky thing here is for EJB2 the relevant cluster-config subelements are "home-load-balance-policy" and "bean-load-balance-policy". For EJB3 its just "load-balance-policy". This difference is reflected in different specifications for cluster-config in jboss_5_0.dtd vs jboss_5_0.xsd.

      When I stop the deploy in a debugger I see that JBossXB is expecting the EJB2 properties, even though ejb-jar specifies ejb-jar_3_0.xsd. The jboss.xml is properly specifying the xmlns and xsi:schemaLocation as well.

      The parsing is being handling by the JBossEjbParsing deployer when this happens.

      Any ideas?

        • 1. Re: Setting load-balance-policy

           

          "bstansberry@jboss.com" wrote:

          First obvious step was to add property loadBalancePolicy to ClusterConfigMetaData. Doesn't help.

          Tricky thing here is for EJB2 the relevant cluster-config subelements are "home-load-balance-policy" and "bean-load-balance-policy". For EJB3 its just "load-balance-policy". This difference is reflected in different specifications for cluster-config in jboss_5_0.dtd vs jboss_5_0.xsd.

          When I stop the deploy in a debugger I see that JBossXB is expecting the EJB2 properties, even though ejb-jar specifies ejb-jar_3_0.xsd. The jboss.xml is properly specifying the xmlns and xsi:schemaLocation as well.

          The parsing is being handling by the JBossEjbParsing deployer when this happens.

          Any ideas?


          JBossXB doesn't look at the schema or dtd. It looks at the class
          to generate the SchemaBinding.
          Try enabling TRACE logging for org.jboss.xb
          and see what it says when it analyzes the ClusterConfigMetaData class.

          The SAXParser will give you a validation error if it doesn't match the schema or dtd.

          You want to write a test in the metadata project (e.g. the everything tests).
          It's easier to debug as well. :-)

          • 2. Re: Setting load-balance-policy

            On a related issue, EJB3 still has seperate home and remote proxies if you configure it
            that way. Shouldn't there be two policies anyway like EJB2?

            • 3. Re: Setting load-balance-policy

               

              "adrian@jboss.org" wrote:
              On a related issue, EJB3 still has seperate home and remote proxies if you configure it
              that way. Shouldn't there be two policies anyway like EJB2?


              I'd make the getter and setter for loadBalancePolicy alias
              the bean policy from EJB2.

              • 4. Re: Setting load-balance-policy
                brian.stansberry

                 

                Shouldn't there be two policies anyway like EJB2?


                Seems like there should be. Cleaner too. The @Clustered annotation currently only exposes one attribute as well, but that's fixable.

                I'd make the getter and setter for loadBalancePolicy alias
                the bean policy from EJB2.


                Yep, that's how I'd done it.


                OK, seems I didn't miss anything blindingly obvious. I'll attack this with a unit test and trace logging from JBossXB.

                Thanks. :)

                • 5. Re: Setting load-balance-policy
                  brian.stansberry

                  Seems the clustered proxy factories didn't support binding home proxies at all:

                  http://jira.jboss.com/jira/browse/EJBTHREE-1109

                  Allowing configuration of home load balance policy:

                  http://jira.jboss.com/jira/browse/EJBTHREE-1110