Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring AOP and AspectJ Integration with EJB3

 
Damodar Wagle
Greenhorn
Posts: 5
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Damodar Wagle
Greenhorn
Posts: 5
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic