atom feed11 messages in org.codehaus.grails.devRe: [grails-dev] Overwriting a metaCl...
FromSent OnAttachments
gmailApr 23, 2010 11:25 am 
Scott BurchApr 23, 2010 11:41 am 
Scott BurchApr 23, 2010 11:54 am 
gmailApr 23, 2010 11:55 am 
Scott BurchApr 23, 2010 12:07 pm 
gmailApr 23, 2010 12:46 pm 
Jeff BrownApr 23, 2010 1:03 pm 
gmailApr 23, 2010 1:42 pm 
K. Michael WilleApr 23, 2010 2:03 pm 
Jeff BrownApr 23, 2010 2:08 pm 
gmailApr 23, 2010 2:37 pm 
Subject:Re: [grails-dev] Overwriting a metaClass method
From:Jeff Brown (
Date:Apr 23, 2010 2:08:10 pm

On Fri, Apr 23, 2010 at 4:03 PM, K. Michael Wille <> wrote:

On Apr 23, 2010, at 4:42 PM, gmail wrote:

On Apr 23, 2010, at 4:03 PM, Jeff Brown wrote:

Are you really sure that both are being called?  Is it possible that only one is being called and that it is doing something that would make it look like the other one was being called as well?

I originally grabbed the mail plugin's source and added debug statements to key
locations like MailService.sendMail.  However, I just noticed that I didn't add
any debug statements to the mail plugin's doWtihApplicationContext where things
are setup.  After doing that, I saw that the Mail Plugin's closure was never
called.  But but the sendMail method in MailService was!

My plugin's service was in the same package as the mail plugin's MailService:
org.grails.plugins.mail.  It had a different class name.  But the method being
called in the closure was the same name in both classes: sendMail.  Nowhere in
my code am I calling MailService.sendMail.  If I rename my service method name
to something like rockAndRoll(), the problem goes away.  I'm not quite sure why
that is...  But at least the problem is fixed.

Thanks a ton for your help Scott and Jeff!

Just in case people think I'm crazy, I'm able to reproduce this issue just by
using the same method names in two differently named services in the same
package.  Though, mabye this is the expected behavior?

Thanks again!

No, that isn't the expected behavior. I expect that something else is going on in your application that explains this. If it really is the case that both methods are being called and you can create a simple demonstrative application, please file a JIRA and attach that app.



Autism Strikes 1 in 166 Find The Cause ~ Find The Cure