New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Startup sometimes fails when used together with resources plugin #148
Comments
Good find and thank you for reporting!. I’ll look into getting this resolved in a later build.
… On Feb 22, 2017, at 6:49 AM, Stefan Rother-Stübs ***@***.***> wrote:
Problem
We are migrating our Grails 2.2.2 application from the resources plugin to the asset-pipeline plugin. Some views are already migrated but most of them still use the resources plugin.
Sometimes the application does not start and produces the following stack trace on initialization of the asset-pipeline:
| 2017-01-27 09:16:25,342 [localhost-startStop-1] ERROR org.grails.plugin.resource.ResourceProcessor - Unable to load resources groovy.lang.MissingMethodException: No signature of method: asset.pipeline.grails.CachingLinkGenerator.appendMapKey() is applicable for argument types: (java.lang.StringBuilder, java.util.LinkedHashMap) values: [resource, [plugin:jquery, dir:js/jquery, ...]] at asset.pipeline.grails.CachingLinkGenerator.makeKey(CachingLinkGenerator.groovy:55) at asset.pipeline.grails.CachingLinkGenerator.resource(CachingLinkGenerator.groovy:24) at org.grails.plugin.resource.ResourceProcessor.buildLinkToOriginalResource(ResourceProcessor.groovy:485) at org.grails.plugin.resource.ResourceModule$_closure1.doCall(ResourceModule.groovy:62) at org.grails.plugin.resource.ResourceModule.<init>(ResourceModule.groovy:58) at org.grails.plugin.resource.ResourceProcessor.defineModuleFromBuilder(ResourceProcessor.groovy:681) at org.grails.plugin.resource.ResourceProcessor$_loadModules_closure19.doCall(ResourceProcessor.groovy:802) at org.grails.plugin.resource.ResourceProcessor.loadModules(ResourceProcessor.groovy:802) at org.grails.plugin.resource.ResourceProcessor.reloadAll(ResourceProcessor.groovy:1075) at ResourcesGrailsPlugin$_closure3.doCall(ResourcesGrailsPlugin.groovy:172) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
The source of the problem seems to be buried in a bug in Groovy (GROOVY-3073 - Private inheritance bug: Closure accessing private method <https://issues.apache.org/jira/browse/GROOVY-3073>) and the fact that the class asset.pipeline.grails.CachingLinkGenerator extends org.codehaus.groovy.grails.web.mapping.CachingLinkGenerator and accesses the private method appendMapKey() from the super class via its makeKey() method.
We were surprised that this is possible (We did not expect the access to private methods of the super class to work) and that this sometimes fails.
The problem appears on our development machines (iMacs with OS X 10.11.6 and JDK 1.7.0_75) and our staging and production systems (Debian 8 with Tomcat 7.0.73 and JDK 1.7.0_111)
Workaround
Our workaround is to inject a modified copy of asset.pipeline.grails.CachingLinkGenerator that has copies of the private methods of the super class that were accessed by makeKey(). Via resources.groovy we inject the class the same way it is done in AssetPipelineGrailsPlugin.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#148>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AABaEl17P65Wk-E_SI8JiDOJ8EE2uzZ8ks5rfC7ZgaJpZM4MImmO>.
|
Seeing the same upgrading to Grails 3.2.8 from 3.2.6.
|
I have the same problem as @jglapa Stepping through in a debugger, i can see that this line: calls this method: when the exception is thrown. |
Same problem in createLink function (Grails updagre 3.2.9 from 3.2.7)
Error in log
|
I started to implement @stefanrother 's workaround in his report, but I found that by reimplementing the private method it depends on another ton of private stuff in the class and doesn't seem feasible. I think the simple fix is for the base class (org.codehaus.groovy.grails.web.mapping.CachingLinkGenerator) to not mark that method as private. Anyone have any pull with the devs of that module? I've never forked grails framework else I'd just do it and submit a PR. My workaround was to stop using g:link which isn't feasible in anything but the short term. |
I wonder why this started happening with just a minor Grails version update. From the release notes it looks like the version was build with a newer |
Downgrading to Groovy 2.4.7 in my Grails 3.2.9 webapp project clears up this problem for me. I did this by:
|
FYI I've raised an issue in the grails core project grails/grails-core#10660 |
UPDATE the method visibility has been changed to This should be available with the next Grails release. |
nice thanks! |
Problem
We are migrating our Grails 2.2.2 application from the resources plugin to the asset-pipeline plugin. Some views are already migrated but most of them still use the resources plugin.
Sometimes the application does not start and produces the following stack trace on initialization of the asset-pipeline:
| 2017-01-27 09:16:25,342 [localhost-startStop-1] ERROR org.grails.plugin.resource.ResourceProcessor - Unable to load resources groovy.lang.MissingMethodException: No signature of method: asset.pipeline.grails.CachingLinkGenerator.appendMapKey() is applicable for argument types: (java.lang.StringBuilder, java.util.LinkedHashMap) values: [resource, [plugin:jquery, dir:js/jquery, ...]] at asset.pipeline.grails.CachingLinkGenerator.makeKey(CachingLinkGenerator.groovy:55) at asset.pipeline.grails.CachingLinkGenerator.resource(CachingLinkGenerator.groovy:24) at org.grails.plugin.resource.ResourceProcessor.buildLinkToOriginalResource(ResourceProcessor.groovy:485) at org.grails.plugin.resource.ResourceModule$_closure1.doCall(ResourceModule.groovy:62) at org.grails.plugin.resource.ResourceModule.<init>(ResourceModule.groovy:58) at org.grails.plugin.resource.ResourceProcessor.defineModuleFromBuilder(ResourceProcessor.groovy:681) at org.grails.plugin.resource.ResourceProcessor$_loadModules_closure19.doCall(ResourceProcessor.groovy:802) at org.grails.plugin.resource.ResourceProcessor.loadModules(ResourceProcessor.groovy:802) at org.grails.plugin.resource.ResourceProcessor.reloadAll(ResourceProcessor.groovy:1075) at ResourcesGrailsPlugin$_closure3.doCall(ResourcesGrailsPlugin.groovy:172) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
The source of the problem seems to be buried in a bug in Groovy (GROOVY-3073 - Private inheritance bug: Closure accessing private method) and the fact that the class
asset.pipeline.grails.CachingLinkGenerator
extendsorg.codehaus.groovy.grails.web.mapping.CachingLinkGenerator
and accesses the private methodappendMapKey()
from the super class via itsmakeKey()
method.We were surprised that this is possible (We did not expect the access to private methods of the super class to work) and that this sometimes fails.
The problem appears on our development machines (iMacs with OS X 10.11.6 and JDK 1.7.0_75) and our staging and production systems (Debian 8 with Tomcat 7.0.73 and JDK 1.7.0_111)
Workaround
Our workaround is to inject a modified copy of
asset.pipeline.grails.CachingLinkGenerator
that has copies of the private methods of the super class that were accessed bymakeKey()
. Viaresources.groovy
we inject the class the same way it is done inAssetPipelineGrailsPlugin
.The text was updated successfully, but these errors were encountered: