• 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 issue

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am new to spring.

Downloaded spring-framework-3.1.0.RC1 and trying to create a simple aop based program.

Please see spring configuration file Application.xml




As mentioned in configuration file, I am using POJO based aspect, but while running my sample program I am facing below exception



i am wondering why this class is not present in spring 3.1. On web I was suggested to add 'aopalliance-1.0.jar'. I add this but after that I got below exception and was suggested to add - aspectjweaver.jar.



I am not sure why spring is asking me to include aspectj jars. Even though I am using POJO base aop. looks like there is an internal dependencies. If I am downloading the complete package of spring then all the libraries must be present in that.


Thanks for reading this.

Thanks,
Vijay
 
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
Because Spring AOP is based on AspectJ AOP project, and therefore some of the classes and stuff are defined by AspectJ and not in Spring. So you have to include some AspectJ jar files. Basically Spring is using some 3rd party classes to implement Spring AOP and they come from AspectJ.

Hope that helps clear things up for you.

Good Luck

I also recommend doing Spring AOP with Annotations, it is much simpler to configure than the xml stuff you are doing. (You still need the AspectJ jars)

Mark
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mark,


So even I am using POJO base AOP, I need AspectJ and associated jar.

I am not sure who can answer it - Why spring library does not include the dependent jars?

Thanks
Vijay
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vijay

Why should Spring contain all dependent jars? When you download any jar, it will normally tell you what other libraries it requires to run.

I think when you use something like Apache Maven, you begin to see the true use of jar files and their dependency on other libraries.
 
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

Vijay Kumar wrote:Thanks Mark,


So even I am using POJO base AOP, I need AspectJ and associated jar.

I am not sure who can answer it - Why spring library does not include the dependent jars?

Thanks
Vijay



Not sure what you mean by POJO base AOP, as for me all my Aspect classes are POJOs, actually all my classes are POJOs.
Spring AOP is a subset of AspectJ and requires some AspectJ jars in the classpath.

Mark
reply
    Bookmark Topic Watch Topic
  • New Topic