This topic has not yet been written. The content below is from the topic description.
AR examples Now let's take a look at a few ways to package ear files. Standard EAR with standalone jboss-aop.xml file If you run $ ant deploy-ear two files get deployed: jboss-aop.xml and aopexample.ear. aopexample.ear contains: aopexample.war aopexampleejb.jar aopexamplelib.jar META-INF/application.xml aopexample.war contains index.jsp WEB-INF/web.xml aopexampeejb.jar contains: org/jboss/injbossaop/ejb/ExampleSession.class org/jboss/injbossaop/ejb/ExampleSessionBean.class org/jboss/injbossaop/ejb/ExampleSessionHome.class META-INF/ejb-jar.xml and, finally aopexamplelib.jar contains: org/jboss/injbossaop/lib/ExampleValue.class org/jboss/injbossaop/lib/SimpleInterceptor.class org/jboss/injbossaop/mbean/Standard.class (Never called in this example) org/jboss/injbossaop/mbean/StandardMBean.class (Never called in this example) org/jboss/injbossaop/web/BasicExampleServlet.class (Never called in this example) org/jboss/injbossaop/web/EarExampleServlet.class There's nothing special about the classes in the ear - the magic comes from deploying the jboss-aop.xml file BEFORE the ear is deployed EAR containing .aop file If you run $ ant deploy-ear-aop One file gets deployed: aopexample.ear. aopexample.ear contains: aopexample.war aopexampleejb.jar aopexamplelib.aop META-INF/application.xml aopexample.war contains: index.jsp WEB-INF/web.xml aopexampeejb.jar contains: org/jboss/injbossaop/ejb/ExampleSession.class org/jboss/injbossaop/ejb/ExampleSessionBean.class org/jboss/injbossaop/ejb/ExampleSessionHome.class META-INF/ejb-jar.xml and, finally aopexamplelib.aop contains: org/jboss/injbossaop/lib/ExampleValue.class org/jboss/injbossaop/lib/SimpleInterceptor.class org/jboss/injbossaop/mbean/Standard.class (Never called in this example) org/jboss/injbossaop/mbean/StandardMBean.class (Never called in this example) org/jboss/injbossaop/web/BasicExampleServlet.class (Never called in this example) org/jboss/injbossaop/web/EarExampleServlet.class META-INF/jboss-aop.xml This is pretty similar to what we had in the standard ear example, apart from that the lib file has now has an .aop extension, and contains a META-INF/jboss-aop.xml file. NOTE: ALL the relevant files in the ear get transformed/intercepted. The jboss-aop.xml file resides in aopexamplelib.aop. aopexampleejb.jar contains ExampleSessionBean (i.e. it is outside of aopexamplelib.aop), but the call to ExampleSessionBean.getValue() still gets intercepted. From JBoss 4.0.5, ear contents are deployed in the order they are listed in application.xml, so you need to make sure that the .aop file comes first for the bindings to be available as the ejb's and servlets get deployed.