• error at ::0 can't find referenced pointcut解决办法(转载)


    原文:http://blog.sina.com.cn/s/blog_9ecb0d9d0101fheg.html

       Spring中采用annotation的方式实现AOP代理,运行测试代码时抛出以下异常:

    Exception in thread "main" org.springframework.beans.factory.BeanCreationException:  Error creating bean with name 'userManager' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut allAddMethod
    Caused by: java.lang.IllegalArgumentExceptionerror at ::0 can't find referenced pointcut 
    allAddMethod                 
    at org.aspectj.weaver.tools.PointcutParser.parsePointcutexpression_r(PointcutParser.java:315)
    at  org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression
                (AspectJExpressionPointcut.java:189)
    at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch
                (AspectJExpressionPointcut.java:176)
    at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter
                (AspectJExpressionPointcut.java:157)
    at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:189)
    at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:244)
    at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:278)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator
                .findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:83)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator
                 .getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:66)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
                .postProcessAfterInitialization(AbstractAutoProxyCreator.java:296)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
               .applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:313)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
               .initializeBean(AbstractAutowireCapableBeanFactory.java:1181)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
                .createBean(AbstractAutowireCapableBeanFactory.java:427)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject
                (AbstractBeanFactory.java:249)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton
                (DefaultSingletonBeanRegistry.java:155)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
                (AbstractBeanFactory.java:246)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
                (AbstractBeanFactory.java:160)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory
                .preInstantiateSingletons(DefaultListableBeanFactory.java:291)
    at org.springframework.context.support.AbstractApplicationContext.refresh
                (AbstractApplicationContext.java:352)
    at org.springframework.context.support.ClassPathXmlApplicationContext.                                          (ClassPathXmlApplicationContext.java:122)
    at org.springframework.context.support.ClassPathXmlApplicationContext.                                          (ClassPathXmlApplicationContext.java:66)
    at com.huang.spring.Client.main(Client.java:10)
     
           本人详细检查过代码和applicationContext.xml配置文件,发现并没有错!而其他Spring项目能运行,因此出错原因可以肯定是aspectj两个jar包的问题。网上很多说法是spring 2.0的版本中的的aspectjrt.jar和jdk不兼容,好吧,本人的JDK是1.7的,于是尝试使用不同版本的aspectjrt.jar文件,发现错误仍然存在!所以不是aspectjrt.jar的问题。
           于是本人下载了最新版本的aspectjweaver.jar并替换了原来的版本,error at ::0 can't find referenced pointcut allAddMethod成功解决了,程序正常运行。
  • 相关阅读:
    [BZOJ 3774] 最优选择 【最小割】
    [XJOI NOI2015模拟题13] C 白黑树 【线段树合并】
    [BZOJ 2212] [Poi2011] Tree Rotations 【线段树合并】
    [XJOI NOI2015模拟题13] B 最小公倍数 【找规律】
    [XJOI NOI2015模拟题13] A 神奇的矩阵 【分块】
    [XJOI NOI02015训练题7] B 线线线 【二分】
    Java+Maven+selenium+testng+reportng自动化测试框架
    selenium实例:unittest框架+PO开发模式
    WebDriver驱动下载地址
    testng 执行多个suite
  • 原文地址:https://www.cnblogs.com/rixiang/p/5189865.html
Copyright © 2020-2023  润新知