Your aop.xml file doesn't include your aspect for weaving, I think if you
add it, that will do it. Try this aop.xml:
<aspectj>
<aspects>
<aspect name="com.leon.aop.HelloAspect"/>
</aspects>
<weaver options="-XnoInline">
<include within="com.leon.aop.HelloWorld"/>
<include within="com.leon.aop.HelloAspect"/>
</weaver>
</aspectj>
Certainly the error indicates the weaver didn't 'finish off' the aspect by
adding the aspectOf() method.
Andy
On 5 June 2014 07:01, 马leon <[email protected]> wrote:
> Hi,
>
> I'm trying to do some hello world test in scala, here're code:
>
>
> class HelloWorld {
> def sayHello() : Unit = println("Hello word")
> }
>
>
> @Aspect
> class HelloAspect {
>
> @Around(value = "execution (* com.leon.aop.HelloWorld.sayHello())")
> def testCP(jp: ProceedingJoinPoint) {
>
> println("Start...")
> jp.proceed()
> println("End...")
>
> }
>
> }
>
>
> myaop.xml:
>
>
> <aspectj>
> <aspects>
> <aspect name="com.leon.aop.HelloAspect"/>
> </aspects>
>
> <weaver options="-XnoInline">
> <include within="com.leon.aop.HelloWorld"/>
> </weaver>
>
> </aspectj>
>
>
> launcher VM settings:
>
> -javaagent:C:\Users\lma\.ivy2\cache\org.aspectj\aspectjweaver\jars\aspectjweaver-1.7.4.jar
> -Dorg.aspectj.weaver.loadtime.configuration=META-INF/myaop.xml
>
>
>
> Testing class:
>
> class HelloAspectTest extends FlatSpecLike with Matchers {
>
> "HelloAspect" should "work" in {
> val t = new HelloWorld
> t.sayHello()
> }
> }
>
>
>
> Yet I got below exception:
>
> An exception or error caused a run to abort:
> com.leon.aop.HelloAspect.aspectOf()Lcom/leon/aop/HelloAspect;
> java.lang.NoSuchMethodError:
> com.leon.aop.HelloAspect.aspectOf()Lcom/leon/aop/HelloAspect;
> at com.leon.aop.HelloWorld.sayHello(HelloWorld.scala:7)
> at
> com.leon.aop.HelloAspectTest$$anonfun$1.apply$mcV$sp(HelloAspectTest.scala:15)
> at com.leon.aop.HelloAspectTest$$anonfun$1.apply(HelloAspectTest.scala:13)
> at com.leon.aop.HelloAspectTest$$anonfun$1.apply(HelloAspectTest.scala:13)
>
>
> Anyone could help me on this?
>
>
> Thank
>
> Leon
>
>
>
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users