I have a problem with aop config. Here is part of my spring xml config:
<bean id="conLogger" class="com.pomkine.pXMPP.connection_service.ConnectionLogger"/>
<aop:config>
<aop:aspect ref="conLogger">
<aop:pointcut id="connect"
expression= "execution(* com.pomkine.pXMPP.connection_service.connectionManager.connect(..))" />
<aop:after pointcut-ref="connect"
method="connected"/>
</aop:aspect>
</aop:config>
Here is my main method:
public static void main (String [] args) {
ApplicationContext ac = new ClassPathXmlApplicationContext("com/pomkine/pXMPP/connection_service/connection-manager.xml");
connectionManager cm=(connectionManager)ac.getBean("connectionManager");
try {
cm.connect();
cm.disconnect();
} catch (XMPPException e) {
e.printStackTrace();
}
}
When I'm runnig it I'm getting NoClassDefFoundError exception.
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connect': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
Can't figure out what the problem is. Would appreciate any help.
This question: Missing Spring AOP libraries in STS seems to address a similar problem (missing libraries), also a problem in this Spring Forum thread.
Do you have the mentioned jars on your classpath?
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.6.11</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With