aspose file tools*
The moose likes Spring and the fly likes Spring AOP and AspectJ Integration with EJB3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring AOP and AspectJ Integration with EJB3" Watch "Spring AOP and AspectJ Integration with EJB3" New topic
Author

Spring AOP and AspectJ Integration with EJB3

Damodar Wagle
Greenhorn

Joined: May 18, 2011
Posts: 5

Hi,
Can anyone give me an headstart on how to integrate Spring AOP ans AspectJ in EJB3.
So far I have figured out the following related to this.

EJB Stateless Session Bean. I am injecting the SaveCreditCardInfoDAO bean into my Controller EJB. But while I am calling the method using the instance I have injected, nothing is getting logged.



beanRefContext.xml


aopContext.xml


Advice Class


ApplicationUtil Class used to load the logger xml file.


When I run my client it gives me following error.


If I remove following line from aopContext.xml then the application runs fine but does not log anything.


All these files and classes are in the same Eclipse project. Only SaveCreditCardInfoDAO is in different project but still its instance is getting injected into the EJB.

Please advice !!!

Regards
Damodar
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Sounds like you still have your classpath issue in your Eclipse project. Hopefully someone in the IDE forum will answer that other thread that I moved over there.

One other thing that I noticed that might cause you problems, is I don't think your pointcut expression is correct.

You are basically saying any method, that takes any number of parameters and returns anything, within any class, within a single package. Meaning only one package level from root. That last part is where I htink your pointcut expression is wrong.

While I never recommend a pointcut expression to be that vague because you open yourself for everything to be advised.

But if you want it all then the expression would be

execution(* *..*.*(..))

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Damodar Wagle
Greenhorn

Joined: May 18, 2011
Posts: 5

Thanks for that new expression. I changed my expression to the new one.
I was trying to log everything so that the expression should not cause hindrance in the logging implementation. Thats the reason I kept it so vague. But anyways the problem still holds. Should I still move this issue in the IDE forum or let it be here?

Thanks and Regards
Damodar
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

This can stay here. But you do need to get your project classpath set correctly to use the other project in its classpath. And that is your project settings in Eclipse.

Mark
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Spring AOP and AspectJ Integration with EJB3