`
米奈希尔
  • 浏览: 268215 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

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

    博客分类:
  • SSH
阅读更多

    在使用注解配置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个错误,贴下我的代码:

	@After("testBeanExecution()")
	public void afterCall(Joinpoint jp) {
		System.out.println("After");
	}

   修改为:

	@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参数,如下:

@Before("com.xyz.myapp.SystemArchitecture.dataAccessOperation() &&" + 
        "args(account,..)")
public void validateAccount(Account account) {
  // ...
}

 

  详细的使用请参考Spring文档吧。顺便附上Spring AOP依赖的jar包。

分享到:
评论
4 楼 cl1090135587 2013-08-21  
的确IDE不全时,没注意啊,org.aspectj.lang.JoinPoint 、 org.aopalliance.intercept.Joinpoint
3 楼 chenjinbo1983 2012-12-18  
感谢分享,换个jar包,搞定
2 楼 黑色郁金香 2012-10-17  
感谢分享,搞定了,主要是第二个错,还真难弄
1 楼 xianrenzhangyan 2012-09-12  
弄了我好久呀,终于弄好了,太谢谢了

相关推荐

    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 问题的解决方法

    根据提供的文件信息,开发者在使用Borland C++ Builder (BCB) 开发环境时遇到了一个典型的链接错误:“[Linker Error] Unresolved external 'mysql_init' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR....

    提示出现unresolved external symbol _main的解决方法

    libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 msvcrtd.lib(crt

    IAR编译错误总结[整理].pdf

    Error[e27]: Entry "tagData" in module Wmmp ( E:\work\MiniFrame\PRJ\LED200_W4\IAR\Debug_in_flash\Obj\Wmmp.r79 ) redefined in module app ( E:\work\MiniFrame\PRJ\LED200_W4\IAR\Debug_in_flash\Obj\app.r79 ...

    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 ...

    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.

    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...

    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 ...

    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 ...

    keil 中常见的几种警告

    3. Error: Can’t open file ‘beep.h’ 这个错误发生在编译过程中,因为找不到#include指令指定的头文件'beep.h'。解决方法是创建一个'beep.h'文件并将其放在指定的工作目录中。 4. Error 237: 'LedOn': function ...

    修复Linux异常自动重启问题

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

    DSP错误总结!

    3. **错误提示:error: can't allocate .text, size 00006e40 (page 0) in LP (avail: 00001000)** 这个错误表明`.text`段(代码段)的大小超过了CMD文件中为LP区域分配的内存。你需要增加LP区域的长度,例如将`LP:...

    AndroidSupportAnnotaitons

    android.support.annotation.* 找不到的问题,

    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 ...

Global site tag (gtag.js) - Google Analytics