Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: [NEWSDELIVER] Getting VerifyError with around advice on static method


Barry,

1. The -XnoWeave option is a relic from earlier versions of AspectJ and is redundant now that -Xreweavable is the default. I am saying that you don't need it and shouldn't use it. If your classes and aspects are built together the aspects will simply be rewoven along with any addition ones defined in aop.xml at load-time. Alternatively you can keep you base application and features added through aspects separate.
2. In the log you posted there was no weaving message for the aspect. In the simple testcase I wrote if I didn't exclude the aspect in the <weaver> section of aop.xml I didn't get the VerifyError because the aspect is woven at load-time even if it wasn't at compile-time:

info AspectJ Weaver Version DEVELOPMENT built on Tuesday Jan 31, 2006 at 13:22:51 GMT
info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader
info using /C:/workspaces/temp/aspectj-users.aspects/bin/META-INF/aop.xml
info register aspect aspects.SeamTransactionsSpringAdapterAspect
info weaving 'Test'
info weaving 'Transactions'
weaveinfo Join point 'method-execution(javax.transaction.UserTransaction Transactions.getUserTransaction())' in Type 'Transactions' (Transactions.java:7) advised by around advice from 'aspects.SeamTransactionsSpringAdapterAspect' (SeamTransactionsSpringAdapterAspect.aj:15)
info generating class 'Transactions$AjcClosure1'
info weaving 'aspects.SeamTransactionsSpringAdapterAspect'
***** SeamTransactionSpringAdapterAspect.getUserTransaction *****

However using the aop.xml below I do get the VerifyError:

<?xml version="1.0" encoding="UTF-8"?>
<aspectj>
        <aspects>
                <aspect name="aspects.SeamTransactionsSpringAdapterAspect"/>
        </aspects>
        <weaver options="-verbose -showWeaveInfo">
                <exclude within="aspects.*"/>
        </weaver>
</aspectj>

info AspectJ Weaver Version DEVELOPMENT built on Tuesday Jan 31, 2006 at 13:22:51 GMT
info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader
info using /C:/workspaces/temp/aspectj-users.aspects/bin/META-INF/aop.xml
info register aspect aspects.SeamTransactionsSpringAdapterAspect
info weaving 'Test'
info weaving 'Transactions'
weaveinfo Join point 'method-execution(javax.transaction.UserTransaction Transactions.getUserTransaction())' in Type 'Transactions' (Transactions.java:7) advised by around advice from 'aspects.SeamTransactionsSpringAdapterAspect' (SeamTransactionsSpringAdapterAspect.aj:15)
info generating class 'Transactions$AjcClosure1'
Exception in thread "main" java.lang.VerifyError: (class: aspects/SeamTransactionsSpringAdapterAspect, method: <clinit> signature: ()V) Stack size too large
        at Transactions.getUserTransaction(Transactions.java:1)
        at Test.main(Test.java:5)

So to summarize: don't use -XnoWeave (in fact the option should be removed soon) and in general take care when excluding aspects from weaving using aop.xml.

Cheers

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/

To:        Matthew Webster/UK/IBM@IBMGB
cc:        
Subject:        Re: [NEWSDELIVER] Getting VerifyError with around advice on static method


Matthew Webster wrote:

I can reproduce your problem if:
1. I build my aspect with -XnoWeave. DON'T. If you get warning turn them off with -Xlint.
2. I exclude my aspect from weaving in aop.xml with "<exclude within=...". Not the best approach. Use a pointcut instead.


1. I /do/ build with noweave set in ajdt because I'm using LTW, not because of any warnings. Are you saying that I don't need to do this? Or that I just shouldn't?

2. I'm confused this point. I don't exclude the aspect via <exclude...>, when I do that the advice is not woven and I get no errors.

-barry


Back to the top