0 Replies Latest reply on Mar 22, 2007 2:21 PM by Aaron Hiniker

    Embedded EJB3 and AOP -- can I get loadtime weaving?

    Aaron Hiniker Newbie

      Hi, I am trying to apply my AOP aspects to an embedded EJB3 test -- when I do that, I get the following error:

      Exception in thread "main" java.lang.ExceptionInInitializerError
      at com.edicorp.EJB3Test.main(EJB3Test.java:28)
      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:597)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
      Caused by: java.lang.RuntimeException: org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/home/hindog/IdeaProjects/maven/edicorp/erp/ejb/target/classes/META-INF/jboss-aop.xml@2,70
      at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.deployXmlResource(EJB3StandaloneBootstrap.java:103)
      at com.edicorp.EJB3Deployer.(EJB3Deployer.java:32)
      ... 6 more
      Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/home/hindog/IdeaProjects/maven/edicorp/erp/ejb/target/classes/META-INF/jboss-aop.xml@2,70
      at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:142)
      at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:133)
      at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:85)
      at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.deployXmlResource(EJB3StandaloneBootstrap.java:97)
      ... 7 more
      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: No cursor for aspect
      at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:280)
      at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:301)
      at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
      at org.apache.xerces.parsers.AbstractXMLDocumentParser.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:138)



      With a very basic AOP configuration:

























      If I load the AOP aspects from the run command, I get IllegalAccessErrors in my beans as it seems the EJBStandaloneDeployer deploys into a separate classloader. So I am trying to do EJB3StandaloneDeployer.deployXmlResource( "my-aop.xml" ) to have the AOP deployed in the same classloader as the beans are managed from.

      I'm not sure if I am doing any of this the right way, is there a method for getting AOP to work in Embedded, or is it not supported (loadtime weaving)?

      Thanks,

      Aaron