Spring XML Namespaces

Tags: xml spring config

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"
    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.


I had also faced same issue while starting a application development Spring 3.0 release.

AOP is removed from 3.0 release.

So,you need to explicitly download and have this particular jar { aopalliance-1.0.jar } in your classpath .

This will solve the problem.

This video can help you solving your question :)
By: admin