Join point matching

In our last episode, I was using the pointcut expression

execution(* com.example.MessageListener(..))

and getting this error:

java.lang.IllegalArgumentException: warning no match for this type name: com.example [Xlint:invalidAbsoluteTypeName]

I Googled this error (alas, my beloved seems to have fewer of the stack trace errors indexed) and found a post to a Spring Framework support forum saying it was the pointcut expression that was incorrect.  And in The AspectJTM Programming Guide under Matching and Some Example Pointcuts it does look like there’s supposed to be a method signature there in the pointcut expression, not just a class name.

Now that I understand the pointcut expressions a little more, I think I’ll take out most of the wildcards for now (I’m leaving the “..” wildcard for the Message parameter for now because when I replaced that with Message, I got some kind of error):

    <aop:pointcut id="stuff" expression="execution(void com.example.MessageListener.onMessage(..))" />
    <aop:advisor advice-ref="txAdvice" pointcut-ref="stuff" />

Now the deployment succeeds… but when my messagelistener throws a RuntimeException the message is still gone from the queue, so it doesn’t seem to be rolling back correctly yet.  So that’s where we’ll start next time!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s