6 Replies Latest reply: Jun 24, 2009 10:36 AM by Kabir Khan RSS

    JBoss XB on IBM VM

    Kabir Khan Master

      Hi Alexey,

      I am resolving some failures of AOP on IBMs VM for EAP 5, and seem to have run into an issue with JBoss XB.

      The problems are to do with deploying things like

      <?xml version="1.0" encoding="UTF-8"?>
      <aop xmlns="urn:jboss:aop-beans:1.0">
       <metadata tag="test" class="org.jboss.test.aop.bean.POJOConstructorTest">
       ..
       </metadata>
      
       <introduction class="org.jboss.test.aop.bean.POJO">
       ..
       </introduction>
      </aop>
      

      I am testing in AS 5.1.0.GA, and these classes are being parsed using
      https://svn.jboss.org/repos/jbossas/projects/microcontainer/tags/2.0.6.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/IntroductionBeanMetaDataFactory.java
      https://svn.jboss.org/repos/jbossas/projects/microcontainer/tags/2.0.6.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/MetaDataBeanMetaDataFactory.java



      Gives errors like:
      16:01:52,751 ERROR [AbstractKernelController] Error installing to Start: name=ayxy-czjy8o-fwaqtybn-1-fwaqvqgf-c9 state=Create
      java.lang.IllegalArgumentException: Neither classes nor expr set
       at org.jboss.aop.microcontainer.beans.IntroductionBinding.start(IntroductionBinding.java:148)
      

      and
      16:01:52,493 ERROR [AbstractKernelController] Error installing to Start: name=ayxy-czjy8o-fwaqtybn-1-fwaqvqge-c3 state=Create
      java.lang.IllegalArgumentException: Null className
       at org.jboss.aop.microcontainer.beans.ClassMetaData.start(ClassMetaData.java:103)
      


      I'll dig into it a bit more, but the only reason I can see for this not happening is if the following methods are never called when parsing:
      IntroductionBeanMetaDataFactory:
       @XmlAttribute(name="class")
       public void setClazz(String clazz)
       {
       this.clazz = clazz;
       }
      

      MetaDataBeanMetaDataFactory:
       @XmlAttribute(name="class")
       public void setClazz(String clazz)
       {
       this.clazz = clazz;
       }
      



        • 1. Re: JBoss XB on IBM VM
          Kabir Khan Master

          I've run the tests for MC 2.0.6.GA on IBMs JDK and added some extra information to verify what I thought in the last post.

          The question is why, it works on Sun's JDK.

          • 2. Re: JBoss XB on IBM VM
            Kabir Khan Master

            For the record, doing

             <introduction expr="has(* *->method())">
             <interfaces>org.jboss.test.microcontainer.beans.IntroductionInterface</interfaces>
             </introduction>
            

            works and correctly sets
             @XmlAttribute(name="expr")
             public void setExpr(String expr)
             {
             this.expr = expr;
             }
            

            in https://svn.jboss.org/repos/jbossas/projects/microcontainer/tags/2.0.6.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/IntroductionBeanMetaDataFactory.java

            • 3. Re: JBoss XB on IBM VM
              Alexey Loubyansky Master

              What if you enable trace for org.jboss.xb.builder? It should tell you how the properties are bound. Maybe there is an issue with reading Java annotations?

              • 4. Re: JBoss XB on IBM VM
                Kabir Khan Master

                The output looks the same for IBM and Sun JDK:

                SUN

                11:48:24,761 TRACE [JBossXBBuilder] Checking property clazz for org.jboss.aop.microcontainer.beans.metadata.IntroductionBeanMetaDataFactory type=java.lang.String
                11:48:24,761 TRACE [JBossXBBuilder] Checking property clazz for org.jboss.aop.microcontainer.beans.metadata.IntroductionBeanMetaDataFactory type=java.lang.String
                11:48:24,761 TRACE [JBossXBBuilder] resolving type java.lang.String
                11:48:24,761 TRACE [JBossXBBuilder] resolving type java.lang.String
                11:48:24,761 TRACE [JBossXBBuilder] resolved type java.lang.String binding=org.jboss.xb.binding.sunday.unmarshalling.SimpleTypeBinding@feb2ea[{http://www.w3.org/2001/XMLSchema}string]
                11:48:24,761 TRACE [JBossXBBuilder] resolved type java.lang.String binding=org.jboss.xb.binding.sunday.unmarshalling.SimpleTypeBinding@feb2ea[{http://www.w3.org/2001/XMLSchema}string]
                11:48:24,761 TRACE [JBossXBBuilder] Bound attribute class type=org.jboss.aop.microcontainer.beans.metadata.IntroductionBeanMetaDataFactory property=clazz propertyType=ReflectClassInfoImpl@945e31{name=java.lang.String}, normalizeSpace=false
                11:48:24,761 TRACE [JBossXBBuilder] Bound attribute class type=org.jboss.aop.microcontainer.beans.metadata.IntroductionBeanMetaDataFactory property=clazz propertyType=ReflectClassInfoImpl@945e31{name=java.lang.String}, normalizeSpace=false
                11:48:24,761 TRACE [JBossXBBuilder] Ignore not element @XmlAttribute for type=org.jboss.aop.microcontainer.beans.metadata.IntroductionBeanMetaDataFactory property=clazz
                11:48:24,761 TRACE [JBossXBBuilder] Ignore not element @XmlAttribute for type=org.jboss.aop.microcontainer.beans.metadata.IntroductionBeanMetaDataFactory property=clazz
                


                IBM
                12:01:04,604 TRACE [JBossXBBuilder] Checking property clazz for org.jboss.aop.microcontainer.beans.metadata.IntroductionBeanMetaDataFactory type=java.lang.String
                12:01:04,604 TRACE [JBossXBBuilder] Checking property clazz for org.jboss.aop.microcontainer.beans.metadata.IntroductionBeanMetaDataFactory type=java.lang.String
                12:01:04,604 TRACE [JBossXBBuilder] resolving type java.lang.String
                12:01:04,604 TRACE [JBossXBBuilder] resolving type java.lang.String
                12:01:04,604 TRACE [JBossXBBuilder] resolved type java.lang.String binding=org.jboss.xb.binding.sunday.unmarshalling.SimpleTypeBinding@78be78be[{http://www.w3.org/2001/XMLSchema}string]
                12:01:04,604 TRACE [JBossXBBuilder] resolved type java.lang.String binding=org.jboss.xb.binding.sunday.unmarshalling.SimpleTypeBinding@78be78be[{http://www.w3.org/2001/XMLSchema}string]
                12:01:04,605 TRACE [JBossXBBuilder] Bound attribute class type=org.jboss.aop.microcontainer.beans.metadata.IntroductionBeanMetaDataFactory property=clazz propertyType=ReflectClassInfoImpl@2fac2fac{name=java.lang.String}, normalizeSpace=false
                12:01:04,605 TRACE [JBossXBBuilder] Bound attribute class type=org.jboss.aop.microcontainer.beans.metadata.IntroductionBeanMetaDataFactory property=clazz propertyType=ReflectClassInfoImpl@2fac2fac{name=java.lang.String}, normalizeSpace=false
                12:01:04,605 TRACE [JBossXBBuilder] Ignore not element @XmlAttribute for type=org.jboss.aop.microcontainer.beans.metadata.IntroductionBeanMetaDataFactory property=clazz
                12:01:04,605 TRACE [JBossXBBuilder] Ignore not element @XmlAttribute for type=org.jboss.aop.microcontainer.beans.metadata.IntroductionBeanMetaDataFactory property=clazz
                

                I am not sure if I am looking in the right place, so I'll zip up and send you the full output.

                One thing that comes to mind might be that I am attempting to override how the class attribute is handled:
                @JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
                @XmlRootElement(name="introduction")
                @XmlType(name="introductionType", propOrder={})
                public class IntroductionBeanMetaDataFactory extends AspectManagerAwareBeanMetaDataFactory
                 implements BeanMetaDataFactory
                {
                 ...
                 @XmlAttribute(name="class")
                 public void setClazz(String clazz)
                 {
                 this.clazz = clazz;
                 }
                }
                
                public abstract class AspectManagerAwareBeanMetaDataFactory extends 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
                {
                 ...
                 @XmlAttribute(name="class")
                 public void setBean(String bean)
                 {
                 this.bean = bean;
                 }
                }
                


                Although this works on Sun, maybe I should get rid of IBMDF.setClazz() and try to use the bean value from the super class instead?

                • 5. Re: JBoss XB on IBM VM
                  Alexey Loubyansky Master

                  Of course, that's the problem. You can't bind two different properties to the same attribute. If you look at the log you will see that one binding overrides the other. The difference between Sun and IBM is the order.