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 Ask.com 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:config>
    <aop:pointcut id="stuff" expression="execution(void com.example.MessageListener.onMessage(..))" />
    <aop:advisor advice-ref="txAdvice" pointcut-ref="stuff" />
</aop:config>

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!

Advertisements

,

  1. Leave a comment

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s