1

我有一个在 JBoss 中运行的 spring mvc 应用程序。我到处都在使用 Spring AOP(使用注释);他们工作得很好。但是,我还想为几个 JBoss 类(特别是它们的登录 JaaS 内容)创建一个方面。

我在我的应用程序中创建了一个 POJO,如下所示:

package com.mycompany.aspect
(all imports here)
@Aspect
public class MyAspect{
    @Pointcut("execution(* org.jboss.plugins.*.login(..))"
    private void myPointCut();

    @Around("myPointCut()")
    public Object doSomething(){....}
}

我还在 META-INF 目录中创建了一个 aop.xml 文件,如下所示:

<aspectj>
   <aspects>
       <aspect name="com.mycompany.aspect.MyAspect"/>
   </aspects>
   <weaver>
       <include within="org.jboss.plugins.*"/>
   </weaver>
</aspectj>

我还添加了以下 jvm 选项:

-javaagent:pathto/aspectjweaver.jar (pathto is the right path to my aspectjweaver.jar file)

当我的应用程序部署时,我得到以下 RuntimeException:

.....无法注册非方面 com$mycompany$aspect$MyAspect, com.mycompany.aspect.MyAspect

我可能做错了什么???

编辑:我应该提到我正在使用 JBoss AS (4.2)...这我无法改变:(

4

0 回答 0