`

error at ::0 can't find referenced pointcut和error at ::0 formal unbound in point

 
阅读更多
   在使用注解配置Spring AOP过程中发现两个error:
1. error at ::0 can't find referenced pointcut
2. error at ::0 formal unbound in point

    对于第1个错误,网上的说法是,如果使用的spring 2.0的版本中的的aspectjrt.jar和jdk6不兼容。
    说下我的环境,JDK7 + Spring 3.6.6,因此不是aspectjrt.jar问题(何以如此确定?请看下文)。最初我也尝试使用不同版本的aspectjrt.jar文件,但都不起作用。于是我怀疑可能是aspectjweaver.jar的问题,因为使用的版本较低(1.5的)。
    于是下载了新版本aspectjweaver-1.6.12替换掉旧的,第1个错误就解决了,而且classpath中没包含aspectjrt.jar。

    再来说下第2个错误,贴下我的代码:
Java代码  收藏代码
@After("testBeanExecution()") 
public void afterCall(Joinpoint jp) { 
    System.out.println("After"); 

   修改为:
Java代码  收藏代码
@After("testBeanExecution()") 
public void afterCall() { 
    System.out.println("After"); 

   这样第2个错误就没了。也就是说去掉afterCall方法中的参数就可以了。

   事实上这种解决办法是不对的,原因是Spring的AOP没那么残废,而是我们使用的不对。
(1)如果要访问JoinPoint,那么我们只需要将org.aspectj.lang.JoinPoint作为通知(advice,如afterCall)中的第一个参数就可以了。那么为什么上面的代码会出错呢。很简单,请仔细看其中的参数,我使用的是org.aopalliance.intercept.Joinpoint,来自aopalliance.jar包。这是使用IDE的自动补全功能时很容易犯的一个错误。所以请确认你写的是否是JoinPoint。
  (2)如果要给通知(advice)传递参数,请使用args参数,如下:
Java代码  收藏代码
@Before("com.xyz.myapp.SystemArchitecture.dataAccessOperation() &&" +  
        "args(account,..)") 
public void validateAccount(Account account) { 
  // ... 



感谢 http://jasonhan-sh-hotmail-com.iteye.com/blog/1486737 
分享到:
评论

相关推荐

    can't find referenced pointcut

    spring-framework-3.1.1.RELEASE jdk1.7 环境下 can't find referenced pointcut 问题解决 换了对应的jar文件即可 aspectjrt.jar aspectj-1.6.6.jar aspectjweaver.jar

    java中的0 can‘t find referenced pointcut runTim

    解决方法 后来经过排查,发现是自己的写法有问题,在@Around的参数中我们使用的是runtime(),这里是有问题的! @Around: 环绕增强,相当于MethodInterceptor. ...@Around: 环绕增强,相当于MethodIn

    aspectjweaver-1.8.9&aspectjrt1;.8.9&aopalliance;-1.0的jar包

    SpringAOP 报错error at ::0 can't find referenced pointcut deleteCell,或类似这样的错误,可能是因为springAOP相关依赖包版本低的缘故,本下载包,可以解决这个问题。

    python UnboundLocalError: local variable ‘x’ referenced before assignment

    一、疑难杂症 def test_scopt(): ...上面这两种情况都会报错:UnboundLocalError: local variable ‘x’ referenced before assignment 二、探究原因 1、python变量作用域   一般在使用函数def、类cla

    aspectj-1.6.6,aspectjrt,aspectjweaver

    spring-framework-3.1.1.RELEASE jdk1.7 环境下can't find referenced pointcut 问题的解决,程序程序无问题的情况下,更换jar文件即可。亲测可用!

    [Linker Error] Unresolved external 问题的解决方法

    BCB里遇到过的问题 [Linker Error] Unresolved external 'mysql_init' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR.LXSERVER\桌面\TESTINSERTMYSQL\UNIT1.OBJ 的解决方案

    ILSpy_binaries_ILSpy 6.1.zip

    New Language Features C# 9.0: Native ints C# 9.0: Attributes on local functions ...Fix #2068: ILSpy can't find referenced library even though it's open And many other fixes, for a full list click here.

    sunjce_provider.jar

    Could not find class 'com.sun.crypto.provider.SunJCE', referenced from method ...不能加载到类的情况

    plat-sw-3.0.0.1.zip

    bazel_root/540135163923dd7d5820f3ee4b306b32/external/adv_plat/plat-sw-3.0.0.1.zip: Connection reset and referenced by '//modules/drivers/camera:camera'. ERROR: (12-26 08:52:07.359) Analysis of target ...

    comsupp.lib源码

    _com_issue_error@@YAXJ@Z) referenced in function "public: __thiscall _variant_t::_variant_t(unsigned short const *)" (??0_variant_t@@QAE@PBG@Z) 的提示,此时需要在project-setting-link中加入comsupp,lib...

    Find Reference 2

    Using FR2 you can then redidrect all those references to a single copy of your choice and safely delete other duplications (usage count of those assets should now be 0) - See all assets not being ...

    Find Reference 2 1.2.10

    Beware that replace references is very powerful yet dangerous operation you'd better don't use it if you don't understand how GUID works in Unity Other Features - Full C# source code - Top notch ...

    修复Linux异常自动重启问题

    这几天训网络最困扰我的问题就是服务器...EXT4-fs error (device sda1): ext4_lookup:1593: inode #6004222: comm trash-expunge: deleted inode referenced: 6004301 类似这样的错误,看样子是sda1磁盘文件系统的问题

    [Linker Error] Unresolved external 'viOpen' referenced from

    [Linker Error] Unresolved external 'viOpen' referenced from 这种错误的解决方法

    BURNINTEST--硬件检测工具

    can stop in the operating system - i.e. there is a problem in the operating system/ device driver that prevents control being returned to the BurnInTest for that test. This was added for ...

    Find out Stored Procs Which Referenced Specified TableName

    Find out Stored Procs Which Referenced Specified TableName

    微软内部资料-SQL性能优化3

    Byte 0: Flag – 0x00 Byte 1: Resource Type – 0x07 (Key) Byte 2-3: DBID – 0x0005 Byte 4-7: ObjectID – 0x 75D7831F (1977058079) Byte 8-9: IndexID – 0x0001 Byte 10-16: Hash Key value – 0x 02014F0...

    stm32f4标准库C++与C混合开发工程

    用C++对stm32的标准库进行开发,包括完整的重定向printf,解决.axf: Error: L6915E: Library reports error: __use_no_semihosting was requested, but _sys_open was referenced以及Error: L6200E:symbol__stdout ...

    CE中文版-启点CE过NP中文.exe

    "find what addresses this code accesses" can also be used on RET instructions now (useful to find callers) The graphical memory view now has a lot more options to set it just the way you need Codepage...

    Foundations of PEAR_ Rapid PHP Development.pdf

    your own port of Scorched Earth in assembler in a different window, and can’t remember what configuration options you used, check the info.php file that’s mentioned in the “Prerequisites” ...

Global site tag (gtag.js) - Google Analytics