Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8796341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:36:03+00:00 2026-06-13T23:36:03+00:00

I am using grails 2.0.1 and overriding render method. i have the following code.

  • 0

I am using grails 2.0.1 and overriding render method.

i have the following code.

 grailsApplication.controllerClasses.each { controller ->
          //keep old render method
          def original = controller.metaClass.getMetaMethod("render", [Map] as Class[])
          controller.metaClass.originalRender = original.getClosure()

          controller.metaClass.renderForBrand = { Map args ->  
          originalRender(args)   
           }
    }

In original.getClosure() i got the below Error.

Message: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.reflection.CachedMethod.getClosure() is applicable for argument types: () values: []
Possible solutions: getClass()
   Line | Method
->> 300 | evaluateEnvironmentSpecificBlock in grails.util.Environment
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   293 | executeForEnvironment            in     ''
|   269 | executeForCurrentEnvironment . . in     ''
|   303 | innerRun                         in java.util.concurrent.FutureTask$Sync
|   138 | run . . . . . . . . . . . . . .  in java.util.concurrent.FutureTask
|   886 | runTask                          in java.util.concurrent.ThreadPoolExecutor$Worker
|   908 | run . . . . . . . . . . . . . .  in     ''
^   662 | run                              in java.lang.Thread

In grails 1.3.7 my code is working fine, In case of grails 2.x it fails.
Any help is greatly appriciated.
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:36:04+00:00Added an answer on June 13, 2026 at 11:36 pm

    You might save a reference to the original render method and call the invoke method in order to execute it:

    grailsApplication.controllerClasses.each { controller ->
              //keep old render method
              def originalRenderMethod = controller.metaClass.getMetaMethod("render", [Map] as Class[])
              controller.metaClass.renderForBrand = { Map args ->  
                  originalRenderMethod.invoke(delegate, args)   
              }
    }
    

    This mechanism works regardless of using Grails 1.3.x or 2.0.x (I tested both).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have issues running grails using grails > run-app If I change a controller
I face a problem using Grails 2 submitToRemote tag. The following code is what
We are using Grails [Spring+Hibernate] and have one service method with @Transactional(readOnly=true). During development
Using Grails database-migration I have a table in production defined like so: +--------------+------------+------+-----+---------+----------------+ |
I'm considering using Grails for my current project. I have a couple of requirements
I'm using Grails 1.3.7 and the db-migration plug-in. I have generated a chagelog.groovy-file containing
Using Grails and CXF, I have published a small web service that looks like
I am using grails 1.3.7. I have a Config.groovy file that specifies a number
I am using Grails 2.1.0 and lesscss-resources 1.3.0.3 I have created a plugin containing
We are using grails-groovy with Hibernate, I have a SQL query like this in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.