Spring aop java.lang.NoClassDefFoundError
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12432526/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Spring aop java.lang.NoClassDefFoundError
提问by pomkine
I have a problem with aop config. Here is part of my spring xml config:
我的 aop 配置有问题。这是我的 spring xml 配置的一部分:
<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.
当我运行它时,我收到 NoClassDefFoundError 异常。
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.
无法弄清楚是什么问题。将不胜感激任何帮助。
回答by Pao
This question: Missing Spring AOP libraries in STSseems to address a similar problem (missing libraries), also a problem in this Spring Forum thread.
这个问题:Missing Spring AOP libraries in STS似乎解决了一个类似的问题(缺少库),也是这个Spring Forum thread 中的一个问题。
Do you have the mentioned jars on your classpath?
你的类路径上有提到的 jars 吗?
<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>