AOP is packaged similarly to SARs(Mbeans). You can either deploy an XML file directly in the deploy/ directory with the signature *-aop.xml or you can use the JAR format. The JAR format must have the file extension .aop and a jboss-aop.xml file must be contained in a META-INF directory. META-INF/jboss-aop.xml.
There is currently a limitation in jboss in that once a class has been loaded that doesn't have any pointcuts defined, you CANNOT add any pointcuts unless you actually redeploy the jar the class is defined in. We have provided a workaround. In jboss/server/--yourconfig--/conf/ you can define a base-aop.xml file to place default pointcuts you want loaded before anything else.
There is an MBean that deploys and manages the AOP framework. In jboss/server/--yourconfig--/conf/jboss-service.xml search for AspectManagerService.
<mbean code="org.jboss.aop.deployment.AspectManagerService" name="jboss.aop:service=AspectManager"> <attribute name="EnableTransformer">false</attribute> <!-- only relevant when EnableTransformer is true --> <attribute name="SuppressTransformationErrors">true</attribute> <!-- only relevant when Enabletransformer is true. Optimization is optional only just in case there is a bug in it --> <attribute name="Optimized">true</attribute> <attribute name="Verbose">false</attribute> </mbean> <mbean code="org.jboss.aop.deployment.AspectDeployer" name="jboss.aop:service=AspectDeployer"> </mbean>
By default, JBoss application server will not do load-time bytecode manipulation of AOP files and you will need to use the precompiler. You can turn this on by setting EnableTransformer to true. SuppressTransformationErrors will only spit out a warning if bytecode transformation fails. This flag is needed because the JSP compiler does not run within a JBoss classloader and the AOP loader cannot resolve classes from this JSP classloader.
javassist.jar |
trove.jar |
jboss-aop.jar |
From the jboss-aop distribution.
From the jboss-aspects32 distribution you need to copy these libraries to the same directory
jboss-aspects.jar |
You must also modify the jboss-3.2.4/server/xxx/conf/jboss-service.xml file to add the mbean definitions you see above.
You must also copy the base-aop.xml file into the server/xxx/conf directory if you want to use any of JBoss Aspects.