Spring Aop开发过程中可能出现的异常(通过这些异常可以知道需要什么Jar包)-阿里云开发者社区

开发者社区> 开发与运维> 正文
登录阅读全文

Spring Aop开发过程中可能出现的异常(通过这些异常可以知道需要什么Jar包)

简介: 出现的问题解决: 问题1:Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframework.util.ClassUtils.<clinit>(ClassUtils.java:67)   at org.sprin
出现的问题解决: 
问题1:Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframework.util.ClassUtils.<clinit>(ClassUtils.java:67)   at org.springframework.core.io.DefaultResourceLoader.<init>(DefaultResourceLoader.java:52) at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:184) at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(AbstractRefreshableApplicationContext.java:80) at org.springframework.context.support.AbstractXmlApplicationContext.<init>(AbstractXmlApplicationContext.java:58)   at 
需要加上:commons-logging.jar log4j-1.2.11.jar 

问题2:Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [text.xml]; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException 
Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException 
    at java.lang.Class.forName0(Native Method) 

需要加上:aspectjweaver.jar 

问题3:Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘logBean’ defined in class path resource [text.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the classpath or specify proxy interfaces. 
Caused by: org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces. 
需要加上:cglib-nodep-2.2.jar 


问题4:xception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘logBean’ defined in class path resource [text.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError:org/objectweb/asm/Type 
Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/Type 
    at net.sf.cglib.core.TypeUtils.parseType(TypeUtils.java:180) 
需要加上:asm.jar 

问题5: Exception in thread "main" java.lang.IllegalArgumentException: warning no match for this type name: Performer [Xlint:invalidAbsoluteTypeName] 
        at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:315) 
        at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:197)
        at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:184)
        at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:165)
        at org.springframework.aop.framework.DefaultAdvisorChainFactory.getInterceptorsAndDynamicInterceptionAdvice(DefaultAdvisorChainFactory.java:60)
        at org.springframework.aop.framework.AdvisedSupport.getInterceptorsAndDynamicInterceptionAdvice(AdvisedSupport.java:465)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:190) 
        at $Proxy0.perform(Unknown Source) 
这种问题一般是由execution表达式写法上的错误导致无法找到匹配的类型 

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章
最新文章
相关文章