tadpole tadpole - 5 months ago 27x
Java Question

How to resolve java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice error?

I am trying to use the spring AOP framework. The code compiled without error.
When I tried to run it, I got the above exception. I am using netbeans IDE 8.0.1.
I have the following libraries and jar files included.

1) Spring Framework 4.0.1
2) aspectjrt.jar
3) aspectjweaver.jar
4) aopalliance-alpha1.jar
5) asm-5.03.jar
6) cglib-3.1.jar

Here is my spring.xml config file

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd


<bean name="triangle" class="springaop.Triangle">
<property name="name" value="My Triangle" />

<bean name="circle" class="springaop.Circle">
<property name="name" value="My Circle" />

<bean name="shapeService" class="springaop.ShapeService" autowire="byName" >

<bean name="loginAspect" class="springaop.LoginAspect" />


These are the latest jar files that are available from each publisher.
I did not see the Advice class anywhere in the aopalliance jar. I searched for this problem. It appears that the Advice class may have been removed from the aopalliance jar. I have not been able to search it. Does anyone know how to resolve this problem other than telling me to use Maven :) ?


I don't know what aopalliance-alpha1 is. You need aopalliance which is at version 1.0. You can get it here. (Download JAR if you aren't using Maven.)