I’m currently working my way through ‘Spring in Action’. Being stuck starting with the aspects, I’d like to know if anybody can see my mistake.
In my AppConfig.xml, I start the bean-declaratiotn with:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
Running the app, I get the following exception:
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [config/AppConfig.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice
The definition might be wrong?
Any help appreciated!
Regards,
Marcus
Make sure you have spring-aop.jar, aopalliance.jar or aspectjtools-1.6.0.jar included in your project. The error is indicating that the Advice class is not found on your class path. It can be found in one of the two jars I mentioned depending on the version of Spring you are using.
http://forum.springsource.org/showthread.php?82282-ava-lang-ClassNotFoundException-org-aopalliance-aop-Advice