1 2 3 4 Previous Next 52 Replies Latest reply: Mar 25, 2008 10:03 AM by Kabir Khan RSS

Implementing JAXB style parsing for aop-mc-int

Kabir Khan Master

I am trying to implement the new JAXB style parsing for aop-mc-int, and have a few questions.

I don't think it will be possible anymore to do things like the following since "deployment" maps onto "AbstractKernelDeployment", which knows nothing about the aop classes.

<deployment xmlns="urn:jboss:bean-deployer:2.0">

 <aspect xmlns="urn:jboss:aop-beans:1.0" class="org.jboss.test.microcontainer.beans.TestAspect">
 </aspect>

 <bind xmlns="urn:jboss:aop-beans:1.0" pointcut="execution(* org.jboss.test.microcontainer.beans.POJO->*(..))">
 <advice aspect="org.jboss.test.microcontainer.beans.TestAspect" name="advice"/>
 </bind>

 <bean name="Bean" class="org.jboss.test.microcontainer.beans.POJO"/>

</deployment>



So I think I need a AOP top-level deployment type, and to rewrite the above xml to something like
<aop xmlns="urn:jboss:aop-beans:1.0" xmlns:bean="urn:jboss:bean-deployer:2.0" >
 <aspect name="withdependency" class="org.jboss.test.microcontainer.beans.TestAspectWithDependency"/>

 <bind xmlns="urn:jboss:aop-beans:1.0" pointcut="execution(* org.jboss.test.microcontainer.beans.POJO->*(..))">
 <advice aspect="org.jboss.test.microcontainer.beans.TestAspect" name="advice"/>
 </bind>

 <bean:bean name="Bean" class="org.jboss.test.microcontainer.beans.POJO"/>
</aop>


This raises a few issues which I will continue to post to this thread once they become a bit clearer


  • 2. Re: Implementing JAXB style parsing for aop-mc-int
    Kabir Khan Master

    Thanks, I will look into that. I think that answers a lot of the other questions I was about to ask.

    However, I also need to be able to have

  • 3. Re: Implementing JAXB style parsing for aop-mc-int
    Kabir Khan Master

    FULL POST...
    Thanks, I will look into that. I think that answers a lot of the other questions I was about to ask.

    However, I also need to be able to have

    <aop>
    </aop>
    


    at the top level so that I can support deployments similar to the current -aop.xml. Do you have any tips on how to achieve that?



  • 5. Re: Implementing JAXB style parsing for aop-mc-int
    Adrian Brock Master

    That should be:

    @JBossXmlSchema(elementFormDefault=XmlNsForm.UNQUALIFIED)
    @XmlRootElement(name="aop")
    public class AOPDeployment extends AbstractKernelDeployment
    {
    }
    



  • 6. Re: Implementing JAXB style parsing for aop-mc-int
    Adrian Brock Master

    I seemed to have editied my posting instead of posting a correction.

    Here's the full correct post:



    Something like:

    @JBossXmlSchema(elementFormDefault=XmlNsForm.UNQUALIFIED)
    @XmlRootElement(name="aop");
    public class AOPDeployment extends AbstractKernelDeployment
    {
    }
    

    Although I don't think Alex has put much testing into unqualified schemas in JBossXB
    so you might want to force people to update their xml to use a namespace?

    @JBossXmlSchema(namespace="urn:jboss:aop:2.0", elementFormDefault=XmlNsForm.QUALIFIED)
    @XmlRootElement(name="aop");
    <aop xmlns="urn:jboss:aop:2.0">
    </aop>
    



  • 7. Re: Implementing JAXB style parsing for aop-mc-int
    Kabir Khan Master

    I am getting the following error when trying to set up the SchemaResolver

    java.lang.RuntimeException: No such property for bean org.jboss.beans.info.spi.EventInfo available []
    at org.jboss.beans.info.spi.EventInfo.
    at org.jboss.beans.info.spi.BeanInfo.events
    at org.jboss.kernel.spi.dependency.KernelControllerContext.beanInfo
    at org.jboss.aop.microcontainer.beans.beanmetadatafactory.AOPDeployment.installedContexts
    at org.jboss.aop.microcontainer.beans.beanmetadatafactory.AOPDeployment
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.rethrowWithLocation(JBossXBNoSchemaBuilder.java:1854)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElementBinding(JBossXBNoSchemaBuilder.java:285)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElements(JBossXBNoSchemaBuilder.java:260)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.build(JBossXBNoSchemaBuilder.java:184)
     at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:102)
     at org.jboss.aop.microcontainer.junit.JAXBDeployer.addSchemaBinding(JAXBDeployer.java:105)
     at org.jboss.aop.microcontainer.junit.JAXBDeployer.setupResolver(JAXBDeployer.java:96)
     at org.jboss.aop.microcontainer.junit.JAXBDeployer.unmarshal(JAXBDeployer.java:82)
     at org.jboss.aop.microcontainer.junit.AOPMicrocontainerTestDelegate.unmarshal(AOPMicrocontainerTestDelegate.java:138)
     at org.jboss.aop.microcontainer.junit.ForceJAXBAOPMicrocontainerTest.unmarshal(ForceJAXBAOPMicrocontainerTest.java:50)
     at org.jboss.test.microcontainer.beans.test.JAXBAnnotationSanityTestCase.unmarshal(JAXBAnnotationSanityTestCase.java:178)
     at org.jboss.test.microcontainer.beans.test.JAXBAnnotationSanityTestCase.testAspectWithDefaultNameAndScope(JAXBAnnotationSanityTestCase.java:62)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at junit.framework.TestCase.runTest(TestCase.java:154)
     at junit.framework.TestCase.runBare(TestCase.java:127)
     at junit.framework.TestResult$1.protect(TestResult.java:106)
     at junit.framework.TestResult.runProtected(TestResult.java:124)
     at junit.framework.TestResult.run(TestResult.java:109)
     at junit.framework.TestCase.run(TestCase.java:118)
     at junit.framework.TestSuite.runTest(TestSuite.java:208)
     at junit.framework.TestSuite.run(TestSuite.java:203)
     at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
     at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
     at junit.framework.TestResult.runProtected(TestResult.java:124)
     at junit.extensions.TestSetup.run(TestSetup.java:23)
     at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
     at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: java.lang.IllegalArgumentException: No such property for bean org.jboss.beans.info.spi.EventInfo available []
     at org.jboss.beans.info.plugins.AbstractBeanInfo.getProperty(AbstractBeanInfo.java:160)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateType(JBossXBNoSchemaBuilder.java:1053)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:695)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:683)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateTypeBinding(JBossXBNoSchemaBuilder.java:462)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.resolveTypeBinding(JBossXBNoSchemaBuilder.java:421)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.bindProperty(JBossXBNoSchemaBuilder.java:1715)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateType(JBossXBNoSchemaBuilder.java:1054)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:695)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:683)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateTypeBinding(JBossXBNoSchemaBuilder.java:462)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.resolveTypeBinding(JBossXBNoSchemaBuilder.java:421)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.bindProperty(JBossXBNoSchemaBuilder.java:1715)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateType(JBossXBNoSchemaBuilder.java:1054)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:695)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:683)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateTypeBinding(JBossXBNoSchemaBuilder.java:462)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.resolveTypeBinding(JBossXBNoSchemaBuilder.java:421)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.bindProperty(JBossXBNoSchemaBuilder.java:1715)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateType(JBossXBNoSchemaBuilder.java:1054)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:695)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:683)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateTypeBinding(JBossXBNoSchemaBuilder.java:462)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.resolveTypeBinding(JBossXBNoSchemaBuilder.java:421)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createElementBinding(JBossXBNoSchemaBuilder.java:300)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElementBinding(JBossXBNoSchemaBuilder.java:280)
     ... 32 more
    
    



     public KernelDeployment unmarshal(final URL url) throws Exception
     {
     TestSchemaResolver resolver = setupResolver();
    
     KernelDeployment deployment = (KernelDeployment)jbossXbTestDelegate.unmarshal(url.toString(), resolver);
    
     deployment.setName(url.toString());
    
     return deployment;
     }
    
     private TestSchemaResolver setupResolver()
     {
     TestSchemaResolver resolver = new TestSchemaResolver();
    
     addSchemaBinding(resolver, AbstractKernelDeployment.class);
     addSchemaBinding(resolver, AOPDeployment.class); //Error happens here
     ...
    
     return resolver;
     }
    
     private SchemaBinding addSchemaBinding(TestSchemaResolver resolver, Class<?> clazz)
     {
     SchemaBinding binding = JBossXBBuilder.build(clazz);
     resolver.addSchemaBinding(binding);
     return binding;
     }
    


    Where
    @JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
    //@JBossXmlSchema(elementFormDefault=XmlNsForm.UNQUALIFIED)
    @XmlRootElement(name="aop")
    public class AOPDeployment extends AbstractKernelDeployment
    {
     private static final long serialVersionUID = 1L;
    }
    




  • 8. Re: Implementing JAXB style parsing for aop-mc-int
    Adrian Brock Master

    It's a stupid error message, it means it can't use some part of your object
    because it is defined using interfaces without any idea of implementation.

    The reason is this in AbstractKernelDeployment (look at the stacktrace of your message)

     public List<KernelControllerContext> getInstalledContexts()
     {
     return installedContexts;
     }
    


    There's two ways to fix it.
    1) You mark either the getter or setter as @XmlTransient
    2) You do like is done on AbstractKernelDeployment and list the
    properties you want to explicity include in the xml

    @XmlType(propOrder={"annotations", "classLoader", "beanFactories", "create", "start", "stop", "destroy", "aliases"})
    


  • 9. Re: Implementing JAXB style parsing for aop-mc-int
    Kabir Khan Master

     

    "kabir.khan@jboss.com" wrote:
    I am getting the following error when trying to set up the SchemaResolver
    java.lang.RuntimeException: No such property for bean org.jboss.beans.info.spi.EventInfo available []
    at org.jboss.beans.info.spi.EventInfo.
    at org.jboss.beans.info.spi.BeanInfo.events
    at org.jboss.kernel.spi.dependency.KernelControllerContext.beanInfo
    at org.jboss.aop.microcontainer.beans.beanmetadatafactory.AOPDeployment.installedContexts
    at org.jboss.aop.microcontainer.beans.beanmetadatafactory.AOPDeployment
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.rethrowWithLocation(JBossXBNoSchemaBuilder.java:1854)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElementBinding(JBossXBNoSchemaBuilder.java:285)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElements(JBossXBNoSchemaBuilder.java:260)
     at org.jboss.xb.builder.JBossXBNoSchemaBuilder.build(JBossXBNoSchemaBuilder.java:184)
     at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:102)
     at org.jboss.aop.microcontainer.junit.JAXBDeployer.addSchemaBinding(JAXBDeployer.java:105)
    



    Adding the same @XMLType as AbstractKernelDeployment fixes it
    @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;
    }
    
    



  • 10. Re: Implementing JAXB style parsing for aop-mc-int
    Kabir Khan Master

    When setting up my schema resolver

     private TestSchemaResolver setupResolver()
     {
     TestSchemaResolver resolver = new TestSchemaResolver();
    
    
     SchemaBinding binding1 = addSchemaBinding(resolver, AbstractKernelDeployment.class);
     SchemaBinding binding2 = addSchemaBinding(resolver, AOPDeployment.class);
     SchemaBinding binding3 = addSchemaBinding(resolver, AspectBeanMetaDataFactory.class);
     SchemaBinding binding4 = addSchemaBinding(resolver, JavaBean.class);
    
     return resolver;
     }
    
     private SchemaBinding addSchemaBinding(TestSchemaResolver resolver, Class<?> clazz)
     {
     SchemaBinding binding = JBossXBBuilder.build(clazz);
     resolver.addSchemaBinding(binding);
     return binding;
     }
    


    the AspectBeanMetaDataFactory replaces the AOPDeployment, which is obvious having looked at the TestSchemaResolver. For AbstractKernelDeployment, all the associated metadata classes are added. My guess is that this is because they are referenced somehow by the AbstractKernelDeployment. If I have understood the previous posts correctly, the AOPDeployment should be kept simple, i.e.:

    @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;
    }
    


    The question is how do I get metadata classes such as AspectBeanMetaDataFactory, into the same SchemaBinding as AOPDeployment (into binding2)?

  • 11. Re: Implementing JAXB style parsing for aop-mc-int
    Kabir Khan Master

    I seem to need more in my AOPDeployment, the following works for both

    <aop xmlns="urn:jboss:aop-beans:1.0">
     <aspect class="org.jboss.test.microcontainer.beans.TestAspect"/>
    </aop>
    

    and
    <deployment xmlns="urn:jboss:bean-deployer:2.0">
     <aspect xmlns="urn:jboss:aop-beans:1.0" class="org.jboss.test.microcontainer.beans.TestAspect"/>
    </deployment>
    


     private TestSchemaResolver setupResolver()
     {
     TestSchemaResolver resolver = new TestSchemaResolver();
    
     SchemaBinding binding = addSchemaBinding(resolver, AbstractKernelDeployment.class);
     binding = addSchemaBinding(resolver, AOPDeployment.class);
     binding = addSchemaBinding(resolver, JavaBean.class);
    
     return resolver;
     }
    

    And I need to add the aspect stuff to AOPDeployment. If "aspects" is not listed in the propOrder it does not get picked up
    @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", "aspects"})
    public class AOPDeployment extends AbstractKernelDeployment
    {
     private static final long serialVersionUID = 1L;
    
     List<AspectBeanMetaDataFactory> aspects;
    
     public List<BeanMetaDataFactory> getBeanFactories()
     {
     return beanFactories;
     }
    
     public List<AspectBeanMetaDataFactory> getAspects()
     {
     return aspects;
     }
    
     @XmlElement(name="aspect")
     public void setAspects(List<AspectBeanMetaDataFactory> aspects)
     {
     this.aspects = aspects;
     }
    
     @Override
     public List<BeanMetaData> getBeans()
     {
     List<BeanMetaData> allBeans = super.getBeans();
     if (allBeans == null)
     {
     allBeans = new ArrayList<BeanMetaData>();
     }
    
     for (AspectBeanMetaDataFactory aspect : aspects)
     {
     allBeans.addAll(aspect.getBeans());
     }
    
     if (allBeans.size() == 0)
     {
     return null;
     }
     return allBeans;
     }
    
    }
    
    


    Does this look like the correct approach?

  • 12. Re: Implementing JAXB style parsing for aop-mc-int
    Adrian Brock Master

    You look to be getting very confused. :-)

    The first problem:


    the AspectBeanMetaDataFactory replaces the AOPDeployment, which is obvious having looked at the TestSchemaResolver. For AbstractKernelDeployment, all the associated metadata classes are added. My guess is that this is because they are referenced somehow by the AbstractKernelDeployment. If I have understood the previous posts correctly, the AOPDeployment should be kept simple, i.e.:


    No its because you are registering two schemas with the same namespace.
    (two top level classes in the resolver).
    You should register one schema for the top level class and annotate the classes
    you want as @XmlRootElement.

    The second problem


    Does this look like the correct approach?


    Looks like you don't understand how it works? :-)

    The aspect element is an xml wildcard in the microcontainer schema.
    If you want it native to your schema, you need to subclasses the setBeanFactories() and
    change the annotations to say what is valid.

    Illustrative example (trying to show how it works):
     @XmlElements
     ({
     @XmlElement(name="aspect", type=AspectFactoryMetaData.class), // aspect in your namespace
     @XmlElement(name="bean" type=AbstractBeanMetaData.class), // bean in your namespace
     @XmlElement(name="bean" namespace="urn:jboss:bean-deployer:2.0", type=AbstractBeanMetaData.class), // bean in the MC namespace
    // etc.
     })
     @XmlAnyElement // This accepts anything in a different namespace that implements BeanMetaDataFactory
     public void setBeanFactories(List<BeanMetaDataFactory> beanFactories)
     {
     // No need for your own interface, just subclass and change annotations
     super.setBeanFactories(beanFactories);
     }
    


    Your element is called {urn:jboss:aop-beans:1.0}aspects.
    It can be used as such (as a wildcard) in the bean schema
    (providing it is a root element in your schema.

    In your schema you just list it explctly and then there's no need to qualify it
    with a namespace, it's native.

  • 13. Re: Implementing JAXB style parsing for aop-mc-int
    Kabir Khan Master

    That makes more sense now. But I am getting the following error for the following xml

    <?xml version="1.0" encoding="UTF-8"?>
    
    <aop xmlns="urn:jboss:aop-beans:1.0">
    
     <bean xmlns="urn:jboss:bean-deployer:2.0" name="AspectManager" class="org.jboss.aop.AspectManager">
     <constructor xmlns="urn:jboss:bean-deployer:2.0" factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
     </bean>
    
     <aspect class="org.jboss.test.microcontainer.beans.TestAspect">
     </aspect>
    
     ...
     </aop>
    


    If I comment out the "constructor" element, it parses, but I want to be able to use stuff from the bean-deployer schema. Error:
    org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/C:/cygwin/home/Kabir/sourcecontrol/microcontainer/aop-mc-int/target/tests-classes/org/jboss/test/microcontainer/beans/test/AspectSimpleJaxbAopTestCase.xml@6,125
     at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:177)
     at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:139)
     at org.jboss.test.xb.builder.JBossXBTestDelegate.unmarshal(JBossXBTestDelegate.java:122)
     at org.jboss.aop.microcontainer.junit.JAXBDeployer.unmarshal(JAXBDeployer.java:84)
     at org.jboss.aop.microcontainer.junit.JAXBDeployer.deploy(JAXBDeployer.java:127)
     at org.jboss.test.kernel.junit.MicrocontainerTestDelegate.deploy(MicrocontainerTestDelegate.java:256)
     at org.jboss.test.kernel.junit.MicrocontainerTestDelegate.deploy(MicrocontainerTestDelegate.java:400)
     at org.jboss.aop.microcontainer.junit.AOPMicrocontainerTestDelegate.deploy(AOPMicrocontainerTestDelegate.java:76)
     at org.jboss.test.kernel.junit.MicrocontainerTestDelegate.setUp(MicrocontainerTestDelegate.java:83)
     at org.jboss.aop.microcontainer.junit.AOPMicrocontainerTestDelegate.setUp(AOPMicrocontainerTestDelegate.java:60)
     at org.jboss.test.AbstractTestSetup.setUp(AbstractTestSetup.java:63)
     at junit.extensions.TestSetup$1.protect(TestSetup.java:18)
     at junit.framework.TestResult.runProtected(TestResult.java:124)
     at junit.extensions.TestSetup.run(TestSetup.java:23)
     at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
     at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:bean-deployer:2.0}constructor not found as a child of {urn:jboss:bean-deployer:2.0}bean
     at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:396)
     at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:407)
     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)
     ... 19 more
    
    


    I get the same error if I do
    <?xml version="1.0" encoding="UTF-8"?>
    
    <aop xmlns="urn:jboss:aop-beans:1.0">
    
     <bean xmlns="urn:jboss:bean-deployer:2.0" name="AspectManager" class="org.jboss.aop.AspectManager">
     <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
     </bean>
    
     <aspect class="org.jboss.test.microcontainer.beans.TestAspect">
     </aspect>
    
     ...
     </aop>
    


    From my schema, the "aop" element is defined as
     <xsd:element name="aop" type="aopType">
     <xsd:annotation>
     <xsd:documentation>
     <![CDATA[
     A domain
     ]]>
     </xsd:documentation>
     </xsd:annotation>
     </xsd:element>
    
     <xsd:complexType name="aopType">
     <xsd:annotation>
     <xsd:documentation>
     <![CDATA[
     aspects or interceptors
     ]]>
     </xsd:documentation>
     </xsd:annotation>
     <xsd:choice minOccurs="0" maxOccurs="unbounded">
     <xsd:element name="domain" type="domainType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="interceptor" type="aspectOrInterceptorType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="aspect" type="aspectOrInterceptorType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="bind" type="bindType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="stack" type="stackType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="typedef" type="typedefType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="cflow-stack" type="cflowStackType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="dynamic-cflow" type="dynamicCflowStackType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="prepare" type="prepareType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="pointcut" type="pointcutType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="annotation-introduction" type="annotationIntroductionType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="precedence" type="precedenceType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="introduction" type="introductionType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="arrayreplacement" type="arrayreplacementType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:element name="arraybind" type="arraybindType" minOccurs="0" maxOccurs="unbounded"/>
     <xsd:any namespace="##other" processContents="strict" minOccurs="0">
     <xsd:annotation>
     <xsd:documentation>An extension value</xsd:documentation>
     </xsd:annotation>
     </xsd:any>
     </xsd:choice>
     </xsd:complexType>
    
    


  • 14. Re: Implementing JAXB style parsing for aop-mc-int
    Adrian Brock Master

    The builder stuff doesn't use the schema, it "generates it" from the annotations.
    Turn on trace logging for org.jboss.xb. It will tell you what it is doing.

    There's also a simple "SchemaPrinter" class you can use to look
    at what it thinks the schema should be.

    Or alternatively, commit the code and Alex or me can look at it.

    I can only guess what the problem is since I can't see your code. :-)

1 2 3 4 Previous Next