Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ in WAR files

I think you want execution(* Person.*(..) throws ModelException, ApplicationException): it needs to specify methods on Person (as well as correctly specifying the exceptions as others have noted).

However, if you're trying to determine methods that exit by throwing an exception, you might want to use after throwing advice and have your pointcut be execution(* Person.*(..)).

Also, I'd change the pointcut name from doPrint to one that describes what is happening at runtime (person computation).

Ron Bodkin
Chief Technology Officer
New Aspects of Security
m: (415) 509-2895

> ------------Original Message-------------
> From: qqasim@xxxxxxxxxxxxxx
> To: aspectj-users@xxxxxxxxxxx
> Date: Fri, Aug-22-2003 9:21 AM
> Subject: [aspectj-users] AspectJ in WAR files
> 
> Hi I am try to do one thing for a log time but without any success.
> 
> I am trying to write some aspects, create a war file and deploy them on Jboss.
> Everyting works apart from the aspects.
> 
> I have 1 java fils: com.person.Person
> 1 aspect file: com.person.PersonAspect
> 
> Person class includes following methods:
> 
> public Vector addSomething(String name, String[] books) 
>             throws ModelException, ApplicationException 
> {...}
> 
> I want to catch the above method, so I wrote following in PersonAspect:
> "
> import  org.apache.log4j.Logger;
> 
> public aspect PersonAspect {
> 	
> 	static Logger logger;
> 
> pointcut doPrint(): execution(* PersonAspect.*(..) throws Exception);
> 
> before (): doPrint()
> 	{
> 		String classname = thisJoinPoint.getSignature().getDeclaringType
> ().getName()+".class";
> 		
> 		logger = Logger.getLogger(classname);
> 		logger.error("LOGGER == aspect b4 " + thisJoinPoint );
> 		
> 		System.out.println("aspect b4 a ");
> }
> }
> 
> However, when I call addSomething(..) no statement is printed onto the console.
> 
> I am wondering if there is something wrong woth my code or is it that JBoss 
> would not print the logging statements.
> 
> regards
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 


Back to the top