Hello everybody,
I'm totally new to AOP and i wish to made my first steps in this world.
I'm using Eclipse 3.0.2, jdk 1.4.2, AOP 1.3.4.

I wish to be able to run AOP code in loadtime mode, weaving aspects on 
pre-existing Java Application.
Let's say I have developed the classical program Hello(World): I already have a 
"World.jar" file containing the .class file corresponding to the following 
simple class:

  | package org.test;
  | 
  | public class World {
  |     
  |     public static void main(String[] args) {
  |         new World().callMe();
  |     }
  |     
  |     public static void callMe(){
  |         System.out.println("Word!");
  |     }    
  | }
  | 
I have created a AOP project in Eclipse, and i have added the World.jar to the 
classpath.
In this AOP project i wrote the following interceptor:

  | package org.test.aop;
  | 
  | import org.jboss.aop.advice.Interceptor;
  | import org.jboss.aop.joinpoint.Invocation;
  | 
  | public class HelloInterceptor implements Interceptor {
  | 
  |     public String getName() {
  |         return "HelloInterceptor";
  |     }
  | 
  |     public Object invoke(Invocation invocation) throws Throwable {
  |         System.out.print("Hello, ");
  |         return invocation.invokeNext();
  |     }
  | }
  | 
Then i wrote in the jboss-aop.xml file of the AOP project the following lines

  | <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  | <aop>
  |     <pointcut expr="execution(public static void 
com.tilab.test.World->callMe())" name="callMe"/>
  |     <bind pointcut="execution(public static void 
com.tilab.test.World->callMe())">
  |         <interceptor class="org.test.aop.HelloInterceptor"/>
  |     </bind>
  | </aop>
  | 
At last, i setted a AOP launch configuration for my AOP project, specifying as 
the Main class org.test.World. In the VM arguments i can see the correct path 
to the jboss-aop.xml file.

But when i  try to execute this AOP project the only output is "World!", hence 
the interceptor not is called. 

Why? How can I correct this configuration?
Thanks in advance, 
   Paolo

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

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


-------------------------------------------------------
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://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to