• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring AOP and AspectJ Integration with EJB3

 
Greenhorn
Posts: 5
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic