Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] aspects in annotations

Hi,

When I uses the following command to run, it fails with java.lang.VerifyError (class: A, method: stop signature: ()V) catch_type not a subclass of Throwable


    java -classpath aspectjweaver.jar:. -javaagent:aspectjweaver.jar A


And the output is

info AspectJ Weaver Version DEVELOPMENT built on Thursday Dec 22, 2005 at 11:22:16 GMT
info register classloader sun.misc.Launcher$AppClassLoader@7494106
info using /home/eric/test/META-INF/aop.xml
info register aspect Ap
info weaving 'A'
info weaver operating in reweavable mode.  Need to verify any required types exist.
weaveinfo Join point 'method-execution(void A.start())' in Type 'A' (A.java:12) advised by afterThrowing advice from 'Ap' (Ap.java)
weaveinfo Join point 'method-execution(void A.stop())' in Type 'A' (A.java:23) advised by afterThrowing advice from 'Ap' (Ap.java)
info weaving 'Ai'
info weaver operating in reweavable mode.  Need to verify any required types exist.
info weaving 'Ap'
info weaver operating in reweavable mode.  Need to verify any required types exist.
Exception in thread "main" java.lang.VerifyError: (class: A, method: stop signature: ()V) catch_type not a subclass of Throwable


I am using SUN JDK (build 1.5.0_06-b05).


Thanks,
Eric


Eric,

Can I assume the code below for "A.java" is generated? When I try to compile it as show with javac I get errors:

Ap.java:6: unclosed string literal
 @AfterThrowing (pointcut = "(execution(public void A.start() throws
                            ^
Ap.java:8: unclosed string literal
java.lang.Exception))", throwing = "ex")
                                      ^
Ap.java:20: ')' expected
}
^
3 errors

If however the "@AfterThrowing" annotation is on a single line your program seems to work:

info AspectJ Weaver Version DEVELOPMENT built on
info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader
info using /C:/temp/ajcSandbox/ajcTest26696.tmp/META-INF/aop.xml
info register aspect Ap
info weaving 'A'
info weaver operating in reweavable mode.  Need to verify any required types exist.
weaveinfo Join point 'method-execution(void A.start())' in Type 'A' (A.java:5) advised by afterThrowing advice from 'Ap' (Ap.java)
weaveinfo Join point 'method-execution(void A.stop())' in Type 'A' (A.java:15) advised by afterThrowing advice from 'Ap' (Ap.java)
info weaving 'Ai'
info weaver operating in reweavable mode.  Need to verify any required types exist.
info weaving 'Ap'
info weaver operating in reweavable mode.  Need to verify any required types exist.
java.lang.Exception
        at Ap.handleException(Ap.java:11)
        at A.stop(A.java:21)
        at A.main(A.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.aspectj.tools.ajc.AjcTestCase.run(AjcTestCase.java:609)
        at org.aspectj.testing.RunSpec.execute(RunSpec.java:56)
        at org.aspectj.testing.AjcTest.runTest(AjcTest.java:68)
        at org.aspectj.testing.XMLBasedAjcTestCase.runTest(XMLBasedAjcTestCase.java:111)
        at org.aspectj.systemtest.ajc150.Ajc150Tests.testError(Ajc150Tests.java:877)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/



Back to the top