Hi,

I am trying to create one custom aspect and deploy in JBoss 4.0.3 SP1

I packaged the aspect in compileaspects.aop jar file with 
META-INF/jboss-aop.xml and the aspect class.

I also have an ear file with a war and ejb jar with appropriate deployment 
descriptors.

Problem 1 -   When I deploy the compiledaspects.aop directly in the deploy 
folder I am able to see the aspect in the aspectDefinitions of AspectManager 
MBean. But when I package the .aop file along with the ear, I could not find 
that in the Aspect Definitions. 

Problem 2  -  Even when it is deployed (by placing the .aop file in the deploy 
folder), I am not sure whether the aspect code is weaved or not. Because, I did 
not see the aspect code executing when the event at the join points gets 
executed.  

Where am I doing wrong?


The jboss-aop.xml is as follows.


  | <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  | <aop>
  |     <aspect class ="nita.aspect.compiletime.ProfileTraceAspect" scope 
="PER_VM"/>
  |     <bind pointcut="execution(* 
*->@nita.aspect.compiletime.ProfileTrace(..))">
  |         <advice name="tracePerf" 
aspect="nita.aspect.compiletime.ProfileTraceAspect"/>
  |     </bind>  
  | </aop>
  | 

ProfileTraceAspect class is as follows.

package nita.aspect.compiletime;
  | 
  | import org.apache.log4j.Logger;
  | import org.jboss.aop.joinpoint.Invocation;
  | import org.jboss.aop.joinpoint.MethodInvocation;
  | 
  | public class ProfileTraceAspect {
  |     public String getName() {               
  |             return "PerfTraceInterceptor";
  |     }
  | 
  |     public Object tracePerf(Invocation invocation) throws Throwable {
  |             long startTime = System.currentTimeMillis();
  |             try{
  |                     return invocation.invokeNext();
  |             }finally{
  |                     long endTime = System.currentTimeMillis();
  |                     java.lang.reflect.Method m = 
((MethodInvocation)invocation).getMethod();
  |                     Class clazz = ((MethodInvocation)invocation).getClass();
  |                     Logger.getLogger(clazz).debug(clazz.getClassLoader());
  |                     
Logger.getLogger(clazz).debug(clazz.getProtectionDomain().getCodeSource());     
                
  |                     
System.out.println("YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY");
  |                     Logger.getLogger(clazz).debug("method " + m.toString() 
+ " time: " + (endTime-startTime) + "ms");
  |             }
  |     }
  | 
  | }
  | 
And the business remote method in one of my beans, I have annotation like this

/**
  |      * Business method
  |      * @ejb.interface-method  view-type = "remote"
  |      * @@nita.aspect.compiletime.ProfileTrace
  |      */
  |     public float calcInterest(float principal, int noOfMonths, float rate) {
  |             return ((float)((principal * noOfMonths * rate)/100));
  |     }
  | 
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3918014#3918014

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3918014


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to