zcwslnh / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

Grails-Melody plugin block closure #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Grails-Melody plugin (0.4/0.3) will disable one of powerful feature in Grails, 
it will blocks all invocations to any closure in class. 

I have a standalone email worker class with lot of closures, the closure and a 
map will be past to a thread as parameters to do backend job. These had been 
working fine without Grails-Melody plugin. 

Here are the detail error:
Exception in thread "pool-3-thread-1" groovy.lang.MissingMethodException: No 
signature of method: com.risguru.gopalgo.s
rvices.EmailService.sendShareWithFriendsEmails() is applicable for argument 
types: (java.util.LinkedHashMap) values: [[
mails2:, emails4:, uniqueKey:ai26TfiP3WGK, emails1:xxxxxx@xxxx.xx, emails5:, 
emails3:, action:emails, controller:us
r, name:xxxxx, link:http://localhost:8080/public/request/ai26TfiP3WGK, 
topic:tttttttttttttt, to:[xxxxx@gmail.com]
 detail:<p>adfasdfa</p>]]
Possible solutions: getSendShareWithFriendsEmails(), 
setSendShareWithFriendsEmails(java.lang.Object)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:501)
        at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
        at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(Constru
torSite.java:107)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:52)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:192)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:208)
        at GrailsMelodyGrailsPlugin$_closure5_closure18_closure19.doCall(GrailsMelodyGrailsPlugin.groovy:144)
        at sun.reflect.GeneratedMethodAccessor657.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:80)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1068)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at com.risguru.common.utility.StandaloneEmailManager$_closure1.doCall(StandaloneEmailManager.groovy:25)
        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:592)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1070)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
        at groovy.lang.Closure.call(Closure.java:276)
        at groovy.lang.Closure.call(Closure.java:289)
        at groovy.lang.Closure$call$0.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at com.risguru.common.utility.Runner.run(RisguruExecutorService.groovy:55)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
        at java.lang.Thread.run(Thread.java:595)

Original issue reported on code.google.com by netwi...@gmail.com on 14 Jul 2010 at 3:14

GoogleCodeExporter commented 9 years ago
Hi,

I don't know if it applies to your case, but have you seen the following thread 
in the grails user list:
http://markmail.org/message/d7insscax6xtlht5 ?

And as Burt said:
"Why would you want a closure in a Service? Closures are executable like methods
but are ignored by Spring, so they cannot be transactional or be proxied in any
way."

That said, what exactly would you change in the grails plugin in order first 
not to break anything and then to fix this issue:
http://plugins.grails.org/grails-grails-melody/trunk/GrailsMelodyGrailsPlugin.gr
oovy ?

Thanks

Original comment by evernat@free.fr on 15 Jul 2010 at 12:12

GoogleCodeExporter commented 9 years ago
it was me created that ticket. 

I already change lot of my codes to use method instead of closure, but this 
case is different, it is kind of a visitor pattern and I don't want to create a 
big list of sub classes to do the things can be handled by a single closure, 
and there are no transactions involved. 

Original comment by netwi...@gmail.com on 15 Jul 2010 at 1:22

GoogleCodeExporter commented 9 years ago
Thanks to a patch from Jean Barmash, committed in svn by Liu Chao (rev 67953), 
this issue with closures is supposed to be fixed. It is ready for the next 
release of the grails plugin (1.0).

http://plugins.grails.org/grails-grails-melody/trunk/GrailsMelodyGrailsPlugin.gr
oovy

Original comment by evernat@free.fr on 18 Jan 2011 at 11:22