Using Ajc compiler with Spring problem AspectJ?

It's difficult without knowing which line 76 is.

It's difficult without knowing which line 76 is: at com.cdf.dfdxc.aspect.logging.LoggingAspect. LogEntry(LoggingAspect. Java:76) but you are using a very aggressive pointcut @Pointcut("within(com.csc.exceed.uow.

*)") public void loggingAspect() {} This matches all kinds of events, not only method executions, but also static and instance inititializers, field access etc. (see the Primitive Pointcuts overview in the AspectJ Quick Reference). If any of these: returns null for joinPoint.getTarget(), this line will throw a NPE: Class clazz = joinPoint.getTarget().getClass(); returns null for joinPoint.getSignature(), this line will throw a NPE: String name = joinPoint.getSignature().getName(); Also, here you are checking for null or empty args: if (ArrayUtils. IsEmpty(joinPoint.getArgs())) { if (!(name.

StartsWith("get")) || (name. StartsWith("set"))) logger. Log(LogLevel.

INFO, clazz, null, BEFORE_STRING, name, but you are using the args nevertheless: constructArgumentsString(clazz, joinPoint.getArgs())); This might also throw a NPE, depending on the code in constructArgumentsString() Check which of these happens on line 76, and you have your candidate for failure. But my first hint would be to replace your aggressive catch-all pointcut with an execution or call pointcut. I would use a combined pointcut, defined in a modular way: // you can easily reuse this @Pointcut("within(com.csc.exceed.uow.

*)") public void myApp() {} // and this @Pointcut("execution(* *. *(..))") public void methodExecution(){} // but this is the pointcut you are actually matching @Pointcut("myApp() && methodExecution()") public void methodExecutionInMyApp(){} @Before("methodExecutionInMyApp()") public void logMethodExecutions(JoinPoint jp){ // your code here } Here's how to make the class thingy NPE-safe: Class clazz = joinPoint.getTarget()! =null?

JoinPoint.getTarget().getClass() : null.

– Sean Patrick Floyd May 4 at 12:56 sorry line 76 is Class clazz = joinPoint.getTarget().getClass();..this was giving the error. Actualy I was earlier using spring aop and there only joinpoints were are pointcuts and I used similar here,without fully understanding the reason. – Vish May 4 at 13:09 @Vish exactly: Spring AOP only catches method executions, real AspectJ catches a lot more than that – Sean Patrick Floyd May 4 at 13:11 @Sean thankfully I have been able to solve all issues using help given above ,i have only one problem, I am not able class object.

This is always giving a null pointer exception....is there any way out here :) – Vish May 47 at 6:59.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions