Hi,
I have been trying to get dynamic AOP to work on our custom classes, but could not.
My environment: JBoss AS 4.0.5, JBoss AOP 1.5.6 GA, JDK 1.5, loadtime weaving
Dynamic AOP works for the following:
1. aopexample.ear - "injboss" example in the tutorial - deploying ear with
standard contents and a standalone jboss-aop.xml
- Modifying jboss-aop.xml in deploy/ directory directly, to add and remove bindings
produces more or fewer logs showing more or fewer interceptions.
- It still works when ear is exploded, the war in it is also exploded, and
aopexamplelib.jar is copied to aopexample.war\WEB-INF\lib as well.
2. custom.ear with ejb1.jar, ejb2.jar, lib1.jar, lib2.jar, app.war and myaspect.jar. The
ear and war are both exploded. There is a test.jsp in the war that executes sample
classes in myaspect.jar. Using in the standalone jboss-aop.xml before JBoss startup:
<prepare expr="execution(* com.mypackage.MyClass*->*(..))"/>
| <prepare expr="execution(* com.custom.shopping.*->*(..))"/>
Add new bindings during runtime:
<bind pointcut="execution(* com.mypackage.MyClass*->*(..))">
| <interceptor class="com.myaspect.MyInterceptor"/>
| </bind>
| <bind pointcut="execution(* com.custom.shopping.*->*(..))">
| <interceptor class="com.myaspect.MyInterceptor"/>
| </bind>
Dynamic AOP works for MyClass* classes, which is only used by test.jsp and packaged in
myaspect.jar.
However, dynamic AOP does NOT work for com.custom.shopping.* classes, which is packaged
inside lib1.jar. lib1.jar is present at custom.ear/ and app.war/WEB-INF/lib/. If this
jar is removed from WEB-INF/lib, a NoClassFoundException will be thrown when hitting a
page of the app that calls the com.custom.shopping.* classes. With the binding added,
there is no logging that shows the AOP aspect weaving.
If I start JBoss with the binding, I can see the shopping classes get intercepted from the
logs. At runtime, if I remove the binding and add it back, I do not get the logs
anymore.
How do I debug the problem? How do I turn on debugging? What do you think is the
problem? Is this a classloader issue? Currently, there are no errors or exceptions.
Appreciate your response.
Anna
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150877#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...