{"action":"created","issue":{"url":"https://api.github.com/repos/bertramdev/asset-pipeline/issues/148","repository_url":"https://api.github.com/repos/bertramdev/asset-pipeline","labels_url":"https://api.github.com/repos/bertramdev/asset-pipeline/issues/148/labels{/name}","comments_url":"https://api.github.com/repos/bertramdev/asset-pipeline/issues/148/comments","events_url":"https://api.github.com/repos/bertramdev/asset-pipeline/issues/148/events","html_url":"https://github.com/bertramdev/asset-pipeline/issues/148","id":209444779,"number":148,"title":"Startup sometimes fails when used together with resources plugin","user":{"login":"stefanrother","id":369554,"avatar_url":"https://avatars2.githubusercontent.com/u/369554?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanrother","html_url":"https://github.com/stefanrother","followers_url":"https://api.github.com/users/stefanrother/followers","following_url":"https://api.github.com/users/stefanrother/following{/other_user}","gists_url":"https://api.github.com/users/stefanrother/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanrother/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanrother/subscriptions","organizations_url":"https://api.github.com/users/stefanrother/orgs","repos_url":"https://api.github.com/users/stefanrother/repos","events_url":"https://api.github.com/users/stefanrother/events{/privacy}","received_events_url":"https://api.github.com/users/stefanrother/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-02-22T12:49:29Z","updated_at":"2017-04-27T01:02:42Z","closed_at":null,"body":"## Problem\r\n\r\nWe 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.\r\n\r\nSometimes the application does not start and produces the following stack trace on initialization of the asset-pipeline:\r\n`| 2017-01-27 09:16:25,342 [localhost-startStop-1] ERROR org.grails.plugin.resource.ResourceProcessor  -\r\nUnable to load resources\r\ngroovy.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, ...]]\r\n       at asset.pipeline.grails.CachingLinkGenerator.makeKey(CachingLinkGenerator.groovy:55)\r\n       at asset.pipeline.grails.CachingLinkGenerator.resource(CachingLinkGenerator.groovy:24)\r\n       at org.grails.plugin.resource.ResourceProcessor.buildLinkToOriginalResource(ResourceProcessor.groovy:485)\r\n       at org.grails.plugin.resource.ResourceModule$_closure1.doCall(ResourceModule.groovy:62)\r\n       at org.grails.plugin.resource.ResourceModule.<init>(ResourceModule.groovy:58)\r\n       at org.grails.plugin.resource.ResourceProcessor.defineModuleFromBuilder(ResourceProcessor.groovy:681)\r\n       at org.grails.plugin.resource.ResourceProcessor$_loadModules_closure19.doCall(ResourceProcessor.groovy:802)\r\n       at org.grails.plugin.resource.ResourceProcessor.loadModules(ResourceProcessor.groovy:802)\r\n       at org.grails.plugin.resource.ResourceProcessor.reloadAll(ResourceProcessor.groovy:1075)\r\n       at ResourcesGrailsPlugin$_closure3.doCall(ResourcesGrailsPlugin.groovy:172)\r\n       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)\r\n       at java.util.concurrent.FutureTask.run(FutureTask.java:262)\r\n       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\r\n       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\r\n       at java.lang.Thread.run(Thread.java:745)\r\n`\r\n\r\nThe 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.\r\n\r\nWe 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.\r\n\r\nThe 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)\r\n\r\n### Workaround\r\n\r\nOur 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`."},"comment":{"url":"https://api.github.com/repos/bertramdev/asset-pipeline/issues/comments/297582443","html_url":"https://github.com/bertramdev/asset-pipeline/issues/148#issuecomment-297582443","issue_url":"https://api.github.com/repos/bertramdev/asset-pipeline/issues/148","id":297582443,"user":{"login":"jukin-jerry","id":26019908,"avatar_url":"https://avatars1.githubusercontent.com/u/26019908?v=3","gravatar_id":"","url":"https://api.github.com/users/jukin-jerry","html_url":"https://github.com/jukin-jerry","followers_url":"https://api.github.com/users/jukin-jerry/followers","following_url":"https://api.github.com/users/jukin-jerry/following{/other_user}","gists_url":"https://api.github.com/users/jukin-jerry/gists{/gist_id}","starred_url":"https://api.github.com/users/jukin-jerry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jukin-jerry/subscriptions","organizations_url":"https://api.github.com/users/jukin-jerry/orgs","repos_url":"https://api.github.com/users/jukin-jerry/repos","events_url":"https://api.github.com/users/jukin-jerry/events{/privacy}","received_events_url":"https://api.github.com/users/jukin-jerry/received_events","type":"User","site_admin":false},"created_at":"2017-04-27T01:02:42Z","updated_at":"2017-04-27T01:02:42Z","body":"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:createLink which isn't feasible in anything but the short term."}}
{"actor":{"display_login":"jukin-jerry"}}