JBossでSpringMVCアプリケーションを実行しています。私はあちこちでSpringAOPを使用しています(アノテーションを使用)。彼らは完璧に働いています。ただし、いくつかの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)を使用していることに言及する必要があります...これは変更できません:(