`

不显示删除回复显示所有回复显示星级回复显示得分回复 关于Spring3.0.4中用annotation方式声明@Pointcut时的报错解决方案[问题点数:

阅读更多
在junit中测试正常通过,然后本人在

Spring3.0.4下测试,缺报错,信息如下:


2010-12-24 16:10:08 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@c2ea3f: startup date [Fri Dec 24 16:10:08 CST 2010]; root of context hierarchy
2010-12-24 16:10:08 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [beans.xml]
2010-12-24 16:10:08 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@513cf0: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,userDao,userService,loginInterceptor,org.springframework.aop.config.internalAutoProxyCreator]; root of factory hierarchy


使aspectj正常工作,还需要几个其他的包,依次如下:
aspectjrt.jar
aspectjweaver.jar
aoplliance-1.0.jar
org.springframework.asm-3.0.2.RELEASE.jar
asm-all-3.2.jar
cglib-nodep-2.1.3.jar

Spring中的相关包:

commons-logging-1.1.1.jar
org.springframework.beans-3.0.4.REALEASE.jar
org.springframework.context-3.0.4.RELEASE.jar
org.springframework.context-support-3.0.4.RELEASE.jar
org.springframework.core-3.0.4-RELEASE.jar
org.springframework.expression-3.0.4-RELEASE.jar
org.springframework.aspects-3.0.4-RELEASE.jar
org.springframework.aop-3.0.4-RELEASE.jar

测试开始……

******************************************************
第一轮测试,Junit测试未通过,显示缺少jar包,尽管没通过,至少是给了提示,

如下:


org.springframework.beans.factory.BeanCreationException:   Error   creating  

bean   with   name  

'org.springframework.aop.config.internalAutoProxyCreator ':   Instantiation  

of   bean   failed;   nested   exception   is  

org.springframework.beans.BeanInstantiationException:   Could   not  

instantiate   bean   class  

[org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoPr

oxyCreator]:   Constructor   threw   exception;   nested   exception   is  

java.lang.NoClassDefFoundError:  

org/aopalliance/intercept/MethodInterceptor
at  

........

第一行得知,缺少aoplliance.jar   导入,再测……
******************************************************************
提示缺少xerces.jar   转机出现在这里,在寻找xerces.jar的时候,看到一篇帖子

,上面大致意思是说,尽量使用Spring本身提供的jar包,这样可以减少bao这件的

排斥性,即不兼容,想了想,也是,找到xerces.jar   导入,再测……

******************************************************************
未果……错误代码没有找到有用信息。

看来aspectjtools包并没有起作用!
这时候想起了刚才看到的建议,然后又进jar库,无意间发现了一个

org.aspectj.aspectjweaver_1.5.3.jar的包,随便把它加了进去,导入
项目,测试开始……
*********************************************************************

Junit测试进度条显示绿色,测试通过,逻辑被调用,切入面工作正常……
日志输出如下:

2010-11-3   17:33:24  

org.springframework.context.support.AbstractApplicationContext  

prepareRefresh
信息:   Refreshing  

org.springframework.context.support.ClassPathXmlApplicationContext@182f0

db:   startup   date   [Wed   Nov   03   17:33:24   CST   2010];   root   of   context  

hierarchy
2010-11-3   17:33:24  

org.springframework.beans.factory.xml.XmlBeanDefinitionReader  

loadBeanDefinitions
信息:   Loading   XML   bean   definitions   from   class   path   resource   [beans.xml]
2010-11-3   17:33:25  

org.springframework.beans.factory.support.DefaultListableBeanFactory  

preInstantiateSingletons
信息:   Pre-instantiating   singletons   in  

org.springframework.beans.factory.support.DefaultListableBeanFactory@1df

280b:   defining   beans  

[org.springframework.context.annotation.internalConfigurationAnnotationP

rocessor,org.springframework.context.annotation.internalAutowiredAnnotat

ionProcessor,org.springframework.context.annotation.internalRequiredAnno

tationProcessor,org.springframework.context.annotation.internalCommonAnn

otationProcessor,logInterceptor,userDAOImpl,userService,org.springframew

ork.aop.config.internalAutoProxyCreator];   root   of   factory   hierarchy
before   method...Avin   hello!
user   saved!--This   is   DAOImpl1


**************************************************************
最后两行的为具体的输出信息,最后一行是目标函数的输出信息,倒数第二行是切

面中的逻辑!   幸运落在了最后的jar包上:org.aspectj.aspectjweaver.jar

经几天测试得到的正确匹配Jar包列表如下:


org.springframework.beans-3.0.4.REALEASE.jar
org.springframework.context-3.0.4.RELEASE.jar
org.springframework.context-support-3.0.4.RELEASE.jar
org.springframework.core-3.0.4-RELEASE.jar
org.springframework.expression-3.0.4-RELEASE.jar
org.springframework.aspects-3.0.4-RELEASE.jar
org.springframework.aop-3.0.4-RELEASE.jar
commons-logging-1.1.1.jar

junit-4.9-SNAPSHOT-20100512-0041.jar
aspectjrt-111.jar
asm-all-3.2.jar
cglib-nodep-2.1.3.jar
aoplliance-1.0.jar
org.springframework.asm-3.0.2.RELEASE.jar
org.aspectj.aspectjweaver_1.5.3.jar


测试至此结束,问题解决……
希望能给遇到此问题的人一些思路……
***************************************

总结:
1.j2ee中很多框架之间存在着错综复杂的jar包依赖关系(估计可以和

linux里边的rpm依赖媲美了……解决依赖关系的方法大多是寻找正确匹配的jar包

,这里向大家提供跟两个jar包的下载网站:

http://www.java2s.com/

http://www.findjar.com/jar/cglib/cglib-nodep/2.1_3/cglib-nodep-

2.1_3.jar.html

2.CSDN很优秀,很多技术性的文章写得很有针对性!学习交流的好地方!
3.Google资料相较于Baidu多很多,尤其是外国技术资料!
4.遇到报错时,冷静分析,找到可能的切入点,保持冷静,清醒!
5.当确定方向正确时,坚持下去!
6.记住,豆芽长一房高,也是根菜!我们要鄙视敌人!   呵呵!


好,关于这个问题就写这么多,希望

对大家有帮助……


同时也期待各位的相互交流指点……
本人在此祝大家平安夜和圣诞节快乐!!!!

  • 大小: 6.6 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics