11 Replies Latest reply on May 11, 2009 10:33 AM by Kabir Khan

    Imposed ordering of elements

    Kabir Khan Master

       

      "alesj" wrote:

      We need to update MC-AOP-int's xmls:
      - http://hudson.qa.jboss.com/hudson/job/AOP%20MC%20Integration%20-%20No%20Weave%20Tests/org.jboss.microcontainer$jboss-aop-mc-int/3451/
      to follow the new strict order rules Alexey impounded.


      The error for one of my tests is:
      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:aop-beans:1.0}class cannot appear in this posi
      tion. Expected content of {urn:jboss:aop-beans:1.0}mixin is sequence: {urn:jboss:aop-beans:1.0}class? {urn:jboss:a
      op-beans:1.0}construction? {urn:jboss:aop-beans:1.0}interfaces?
       at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:4
      94)
      

      My schema is:
       <xsd:complexType name="mixinType">
       <xsd:annotation>
       <xsd:documentation>
       <![CDATA[
       A mixin within an interface introduction
       ]]>
       </xsd:documentation>
       </xsd:annotation>
       <xsd:all minOccurs="1" maxOccurs="1">
       <xsd:element name="interfaces" type="xsd:string" minOccurs="1" maxOccurs="1" />
       <xsd:element name="class" type="xsd:string" minOccurs="1" maxOccurs="1" />
       <xsd:element name="construction" type="xsd:string" minOccurs="0" maxOccurs="1" />
       </xsd:all>
       <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>
       </xsd:complexType>
      

      So I can only conclude that the order imposed is from the order of the setters in the associated parser class, which truly sucks:
      public class MixinData
      {
       String mixin;
       boolean isTransient = true;
       String construction;
       String interfaces;
      
       public boolean getTransient()
       {
       return isTransient;
       }
      
       @XmlAttribute
       public void setTransient(boolean isTransient)
       {
       this.isTransient = isTransient;
       }
      
       public String getMixin()
       {
       return mixin;
       }
      
       @XmlElement(name="class")
       public void setMixin(String mixin)
       {
       this.mixin = mixin;
       }
      
       public String getConstruction()
       {
       return construction;
       }
      
       public void setConstruction(String construction)
       {
       this.construction = construction;
       }
      
       public String getInterfaces()
       {
       return interfaces;
       }
      
       public void setInterfaces(String interfaces)
       {
       this.interfaces = interfaces;
       }
      }
      

      Is there some annotation that can be used on the class to get rid of this imposed ordering?


        • 1. Re: Imposed ordering of elements
          Ales Justin Master

          @XmlType::propOrder

          • 2. Re: Imposed ordering of elements
            jaikiran pai Master

            Doesn't xsd:all mean unordered elements? Any reason why the order is being imposed?

            • 3. Re: Imposed ordering of elements
              Jason Greene Master

              The annotation metada is used as the driving source for jaxb based parsers. The value of propOrder should be set to "{}" when you want xsd:all (unordered) behavior. This is what xjc would have generated.

              • 4. Re: Imposed ordering of elements
                Kabir Khan Master

                 

                "jason.greene@jboss.com" wrote:
                The value of propOrder should be set to "{}" when you want xsd:all (unordered) behavior.

                Thanks, it fixes things locally. I started a new Hudson run to verify

                • 5. Re: Imposed ordering of elements
                  Kabir Khan Master

                  Coming back to this a number of my tests are failing again. When parsing the following xml

                  <deployment xmlns="urn:jboss:bean-deployer:2.0">
                  
                   <bean name="AspectManager" class="org.jboss.aop.AspectManager">
                   <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
                   </bean>
                  
                   <aspect xmlns="urn:jboss:aop-beans:1.0" name="InterceptedAdvice" class="org.jboss.test.microcontainer.support.TestAspect"/> <!-- Line 9 -->
                  
                   ...
                  </deployment>
                  


                  It falls over with the following exception
                  org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/Users/kabir/sourcecontrol/microcontainer/Branch_2_0/subversion/aop-mc-int/target/test-classes/org/jboss/test/microcontainer/test/SimpleAspectTestCase.xml@9,127
                   at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:177)
                  ...
                  Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Property order is not specified for type org.jboss.aop.microcontainer.beans.metadata.AnnotationOverrideBeanMetaDataFactory bound to a sequence. Property order can be specified using @XmlTy
                  pe.propOrder or @XmlAccessorOrder. List of properties: demands start classLoader installs properties uninstalls annotations constructor create installCallbacks beans supplies uninstallCallbacks depends classShortName aliases
                  at org.jboss.aop.microcontainer.beans.metadata.AOPDeployment.beanFactories
                  at org.jboss.aop.microcontainer.beans.metadata.AOPDeployment
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.rethrowWithLocation(JBossXBNoSchemaBuilder.java:2018)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElementBinding(JBossXBNoSchemaBuilder.java:346)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElements(JBossXBNoSchemaBuilder.java:321)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.build(JBossXBNoSchemaBuilder.java:232)
                   at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:291)
                   at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:181)
                   at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:160)
                   at org.jboss.xb.binding.resolver.AbstractMutableSchemaResolver.resolve(AbstractMutableSchemaResolver.java:261)
                   at org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding.getElement(WildcardBinding.java:174)
                   at org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding$1.startElement(SequenceBinding.java:276)
                   at org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding$1.startElement(SequenceBinding.java:223)
                   at org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding$Cursor.startElement(ModelGroupBinding.java:220)
                   at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:423)
                   at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:401)
                   at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
                   at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
                   at org.apache.xerces.xinclude.XIncludeHandler.emptyElement(Unknown Source)
                   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
                   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
                   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 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 Source)
                   at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:173)
                   ... 22 more
                  Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Property order is not specified for type org.jboss.aop.microcontainer.beans.metadata.AnnotationOverrideBeanMetaDataFactory bound to a sequence. Property order can be specified using @XmlTy
                  pe.propOrder or @XmlAccessorOrder. List of properties: demands start classLoader installs properties uninstalls annotations constructor create installCallbacks beans supplies uninstallCallbacks depends classShortName aliases
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.assertPropOrderNotRequired(JBossXBNoSchemaBuilder.java:1278)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateType(JBossXBNoSchemaBuilder.java:1071)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:779)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:767)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateTypeBinding(JBossXBNoSchemaBuilder.java:523)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.resolveTypeBinding(JBossXBNoSchemaBuilder.java:482)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.bindProperty(JBossXBNoSchemaBuilder.java:1684)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateType(JBossXBNoSchemaBuilder.java:1118)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:779)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:767)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateTypeBinding(JBossXBNoSchemaBuilder.java:523)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.resolveTypeBinding(JBossXBNoSchemaBuilder.java:482)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createElementBinding(JBossXBNoSchemaBuilder.java:361)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElementBinding(JBossXBNoSchemaBuilder.java:341)
                   ... 46 more
                  

                  This seems to be on first access to anything within the "urn:jboss:aop-beans:1.0" schema, and I believe it is from trying to parse the schema. Here is the top-level class:
                  @ManagementObject(properties = ManagementProperties.EXPLICIT) // TODO - explicitly add props we want to manage
                  @JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
                  @XmlRootElement(name="aop")
                  @XmlType(propOrder={"annotations", "classLoader", "beanFactories", "create", "start", "stop", "destroy", "aliases"})
                  public class AOPDeployment extends AbstractKernelDeployment
                  {
                   private static final long serialVersionUID = 1L;
                  
                  
                   @XmlElements
                   ({
                   @XmlElement(name="annotation", type=AnnotationOverrideBeanMetaDataFactory.class),
                   @XmlElement(name="annotation-introduction", type=AnnotationIntroductionBeanMetaDataFactory.class),
                   @XmlElement(name="arrayreplacement", type=ArrayReplacementBeanMetaDataFactory.class),
                   //Many more!
                   })
                   @XmlAnyElement
                   public void setBeanFactories(List<BeanMetaDataFactory> beanFactories)
                   {
                   super.setBeanFactories(beanFactories);
                   }
                  }
                  


                  AnnotationOverrideBeanMetaDataFactory:
                  @JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
                  @XmlRootElement(name="annotation")
                  public class AnnotationOverrideBeanMetaDataFactory extends AbstractAnnotationBeanMetaDataFactory
                  {
                  
                   private static final long serialVersionUID = 1L;
                  
                   @Override
                   protected String getBeanClassName()
                   {
                   return AnnotationOverride.class.getName();
                   }
                  }
                  


                  AbstractAnnotationBeanMetaDataFactory
                  public abstract class AbstractAnnotationBeanMetaDataFactory extends AspectManagerAwareBeanMetaDataFactory
                  {
                   private static final long serialVersionUID = 1L;
                  
                   String expr;
                  
                   boolean invisible;
                  
                   String annotation;
                  
                   public String getExpr()
                   {
                   return expr;
                   }
                  
                   @XmlAttribute
                   public void setExpr(String expr)
                   {
                   this.expr = expr;
                   }
                  
                   public boolean isInvisible()
                   {
                   return invisible;
                   }
                  
                   @XmlAttribute
                   public void setInvisible(boolean invisible)
                   {
                   this.invisible = invisible;
                   }
                  
                   public String getAnnotation()
                   {
                   return annotation;
                   }
                  
                   @XmlValue
                   public void setAnnotation(String annotation)
                   {
                   this.annotation = annotation;
                   }
                  
                   @Override
                   public List<BeanMetaData> getBeans()
                   {
                   ArrayList<BeanMetaData> result = new ArrayList<BeanMetaData>();
                   if (name == null)
                   {
                   name = GUID.asString();
                   }
                   BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, getBeanClassName());
                   builder.addPropertyMetaData("invisible", invisible);
                   builder.addPropertyMetaData("expr", expr);
                   builder.addPropertyMetaData("annotation", annotation);
                  
                   setAspectManagerProperty(builder);
                  
                   result.add(builder.getBeanMetaData());
                  
                   return result;
                   }
                  
                  
                   protected abstract String getBeanClassName();
                  }
                  

                  AspectManagerAwareBeanMetaDataFactory
                  public abstract class AspectManagerAwareBeanMetaDataFactory extends GenericBeanFactoryMetaData
                  {
                   //Setters to handle the aspectmanager to add the aop metadata to
                  }
                  


                  Then from MC we have GenericBeanFactoryMetaData
                  @XmlRootElement(name="beanfactory")
                  @XmlType(name="beanfactoryType", propOrder={"aliases", "annotations", "classLoader", "constructor", "properties", "create", "start", "depends", "demands", "supplies", "installs", "uninstalls", "installCallbacks", "uninstallCallbacks"})
                  public class GenericBeanFactoryMetaData extends JBossObject implements BeanMetaDataFactory, Serializable
                  {
                   ...
                  }
                  


                  If I add @XmlType(propOrder={})to AnnotationOverrideBeanMetaDataFactory:
                  @JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
                  @XmlRootElement(name="annotation")
                  @XmlType(propOrder={})
                  public class AnnotationOverrideBeanMetaDataFactory extends AbstractAnnotationBeanMetaDataFactory
                  {
                  
                   private static final long serialVersionUID = 1L;
                  
                   @Override
                   protected String getBeanClassName()
                   {
                   return AnnotationOverride.class.getName();
                   }
                  }
                  


                  I then get a new error
                  org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/Users/kabir/sourcecontrol/microcontainer/Branch_2_0/subversion/aop-mc-int/target/test-classes/org/jboss/test/microcontainer/test/SimpleAspectTestCase.xml@9,127
                   at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:177)
                  Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Property order is not specified for type org.jboss.beans.metadata.spi.BeanMetaData bound to a sequence. Property order can be specified using @XmlType.propOrder or @XmlAccessorOrder. List of
                   properties: demands start classLoader installs properties related uninstalls destroy annotations accessMode errorHandlingMode constructor create autowireType installCallbacks name supplies mode uninstallCallbacks bean depends stop abstract autowi
                  reCandidate parent aliases
                  at org.jboss.aop.microcontainer.beans.metadata.AnnotationOverrideBeanMetaDataFactory.beans
                  at org.jboss.aop.microcontainer.beans.metadata.AOPDeployment.beanFactories
                  at org.jboss.aop.microcontainer.beans.metadata.AOPDeployment
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.rethrowWithLocation(JBossXBNoSchemaBuilder.java:2018)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElementBinding(JBossXBNoSchemaBuilder.java:346)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElements(JBossXBNoSchemaBuilder.java:321)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.build(JBossXBNoSchemaBuilder.java:232)
                   at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:291)
                   at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:181)
                   at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:160)
                   at org.jboss.xb.binding.resolver.AbstractMutableSchemaResolver.resolve(AbstractMutableSchemaResolver.java:261)
                   at org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding.getElement(WildcardBinding.java:174)
                   at org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding$1.startElement(SequenceBinding.java:276)
                   at org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding$1.startElement(SequenceBinding.java:223)
                   at org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding$Cursor.startElement(ModelGroupBinding.java:220)
                   at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:423)
                   at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:401)
                   at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
                   at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
                   at org.apache.xerces.xinclude.XIncludeHandler.emptyElement(Unknown Source)
                   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
                   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
                   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 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 Source)
                   at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:173)
                   ... 22 more
                  Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Property order is not specified for type org.jboss.beans.metadata.spi.BeanMetaData bound to a sequence. Property order can be specified using @XmlType.propOrder or @XmlAccessorOrder. List of
                   properties: demands start classLoader installs properties related uninstalls destroy annotations accessMode errorHandlingMode constructor create autowireType installCallbacks name supplies mode uninstallCallbacks bean depends stop abstract autowi
                  reCandidate parent aliases
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.assertPropOrderNotRequired(JBossXBNoSchemaBuilder.java:1278)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateType(JBossXBNoSchemaBuilder.java:1071)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:779)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:767)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateTypeBinding(JBossXBNoSchemaBuilder.java:523)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.resolveTypeBinding(JBossXBNoSchemaBuilder.java:482)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.bindProperty(JBossXBNoSchemaBuilder.java:1684)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateType(JBossXBNoSchemaBuilder.java:1118)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:779)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:767)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateTypeBinding(JBossXBNoSchemaBuilder.java:523)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.resolveTypeBinding(JBossXBNoSchemaBuilder.java:482)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.bindProperty(JBossXBNoSchemaBuilder.java:1684)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateType(JBossXBNoSchemaBuilder.java:1118)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:779)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:767)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateTypeBinding(JBossXBNoSchemaBuilder.java:523)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.resolveTypeBinding(JBossXBNoSchemaBuilder.java:482)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createElementBinding(JBossXBNoSchemaBuilder.java:361)
                   at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElementBinding(JBossXBNoSchemaBuilder.java:341)
                   ... 46 more
                  


                  First, I thought it might be due to the @XmlType set in the AnnotationOverrideBeanMetaDataFactory somehow interfering with the one in its superclass GenericBeanFactoryMetaData.

                  But it looks more likely that is is due to BeanMetaData which is returned by the AnnotationOverrideBeanMetaDataFactory.getBeans() not having @XmlType(propOrder={})? BeanMetaData is an mc spi interface with no xb annotations. The annotations are on impl classes instead, which is probably how it should be?

                  If my reasoning is correct, how to get around this?

                  • 6. Re: Imposed ordering of elements
                    Alexey Loubyansky Master

                    As the error reads, you have to specify property order for org.jboss.aop.microcontainer.beans.metadata.AnnotationOverrideBeanMetaDataFactory.

                    I don't know why XmlType specified on a super class is not visible.
                    propOrder={} binds to model group all instead of sequence. Check out the javadoc for XmlType, it has an example and explanation.

                    The last error says BeanMetaData is missing property order as well.

                    • 7. Re: Imposed ordering of elements
                      Kabir Khan Master

                      AnnotationOverrideBeanMetaDataFactory passes if I annotate the class with @XmlType(propOrder={}) and the AbstractAnnotationBeanMetaDataFactory.getBeans() method with @XmlTransient.

                      A few more classes get through when I do this, but I get another error

                      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Model group all may contain only elements!
                      at org.jboss.aop.microcontainer.beans.metadata.ArrayBindBeanMetaDataFactory.interceptors
                      at org.jboss.aop.microcontainer.beans.metadata.AOPDeployment.beanFactories
                      at org.jboss.aop.microcontainer.beans.metadata.AOPDeployment
                       at org.jboss.xb.builder.JBossXBNoSchemaBuilder.rethrowWithLocation(JBossXBNoSchemaBuilder.java:2018)
                       at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElementBinding(JBossXBNoSchemaBuilder.java:346)
                       at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElements(JBossXBNoSchemaBuilder.java:321)
                       at org.jboss.xb.builder.JBossXBNoSchemaBuilder.build(JBossXBNoSchemaBuilder.java:232)
                       at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:291)
                       at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:181)
                       at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:160)
                       at org.jboss.xb.binding.resolver.AbstractMutableSchemaResolver.resolve(AbstractMutableSchemaResolver.java:261)
                       at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:274)
                       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:401)
                       at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
                       at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
                       at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
                       at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
                       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
                       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 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 Source)
                       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:173)
                      


                      @JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
                      @XmlRootElement(name="arraybind")
                      @XmlType(propOrder= {})
                      public class ArrayBindBeanMetaDataFactory extends AspectManagerAwareBeanMetaDataFactory
                      {
                      
                       ...
                       @Override
                       @XmlTransient
                       public List<BeanMetaData> getBeans()
                       {
                       ...
                       }
                      
                       @XmlElements
                       ({
                       @XmlElement(name="advice", type=AdviceData.class),
                       @XmlElement(name="around", type=AdviceData.class),
                       @XmlElement(name="before", type=BeforeAdviceData.class),
                       @XmlElement(name="after", type=AfterAdviceData.class),
                       @XmlElement(name="throwing", type=ThrowingAdviceData.class),
                       @XmlElement(name="finally", type=FinallyAdviceData.class),
                       @XmlElement(name="interceptor-ref", type=InterceptorRefData.class),
                       @XmlElement(name="stack-ref", type=StackRefData.class)
                       })
                       public List<BaseInterceptorData> getInterceptors()
                       {
                       return interceptors;
                       }
                      
                       public void setInterceptors(List<BaseInterceptorData> interceptors)
                       {
                       this.interceptors = interceptors;
                       }
                      }
                      

                      What does it mean?

                      • 8. Re: Imposed ordering of elements
                        Kabir Khan Master

                        Aha, I think it means I need to use @Xml(Root)Element on the AdviceData classes

                        • 9. Re: Imposed ordering of elements
                          Kabir Khan Master

                          If I annotate my classes with

                          @XmlRootElement
                          public class BeforeAdviceData extends AdviceData
                          

                          @XmlRootElement
                          public class AdviceData extends AdviceOrInterceptorData
                          


                          This passes
                          @JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
                          @XmlRootElement(name="arraybind")
                          @XmlType(propOrder= {})
                          public class ArrayBindBeanMetaDataFactory extends AspectManagerAwareBeanMetaDataFactory
                          {
                          @XmlElements
                           ({
                           @XmlElement(name="advice", type=AdviceData.class)
                           })
                           public List<BaseInterceptorData> getInterceptors()
                           {
                           return interceptors;
                           }
                          }
                          

                          and this passes
                          @JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
                          @XmlRootElement(name="arraybind")
                          @XmlType(propOrder= {})
                          public class ArrayBindBeanMetaDataFactory extends AspectManagerAwareBeanMetaDataFactory
                          {
                          @XmlElements
                           ({
                           @XmlElement(name="advice", type=BeforeAdviceData.class)
                           })
                           public List<BaseInterceptorData> getInterceptors()
                           {
                           return interceptors;
                           }
                          }
                          

                          but if I try to use both, I get the "Model group all may contain only elements!" error mentioned:
                          
                          
                          @JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
                          @XmlRootElement(name="arraybind")
                          @XmlType(propOrder= {})
                          public class ArrayBindBeanMetaDataFactory extends AspectManagerAwareBeanMetaDataFactory
                          {
                          @XmlElements
                           ({
                           @XmlElement(name="advice", type=AdviceData.class),
                           @XmlElement(name="advice", type=BeforeAdviceData.class)
                           })
                           public List<BaseInterceptorData> getInterceptors()
                           {
                           return interceptors;
                           }
                          }
                          
                          


                          • 10. Re: Imposed ordering of elements
                            Alexey Loubyansky Master

                            As I mentioned before, @XmlType(propOrder= {}) binds to a model group all (http://www.w3.org/TR/xmlschema-1/#Model_Groups) which can contain only elements (not sequences or choices). Interceptors in your case will be bound to a repeatable choice. See javadoc for XmlElements.

                            • 11. Re: Imposed ordering of elements
                              Kabir Khan Master

                              I got this working with a bit of help from Ales. I'll commit the changes against https://jira.jboss.org/jira/browse/JBMICROCONT-426