Skip to content
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

MissingMethodException when message() is invoked from action #2

Open
ghost opened this issue Mar 14, 2011 · 1 comment
Open

MissingMethodException when message() is invoked from action #2

ghost opened this issue Mar 14, 2011 · 1 comment

Comments

@ghost
Copy link

ghost commented Mar 14, 2011

I've got an MissingMethodException when I configured transactions to my controller.
I used static field static transactional = [ 'merge' ].
Here is the exception:
groovy.lang.MissingMethodException: No signature of method: com.profiprog.asap.BankEmployeeController.message() is applicable for argument types: (java.util.LinkedHashMap) values: [[code:bankEmployee.label, default:BankEmployee]]
Possible solutions: getSave(), setSave(java.lang.Object), isCase(java.lang.Object)
at TransactionalControllerGrailsPlugin$_decorateClosures_closure3.doCall(TransactionalControllerGrailsPlugin.groovy:125)
at com.profiprog.asap.BankEmployeeController.invokeMethod(BankEmployeeController.groovy)
at com.profiprog.asap.BankEmployeeController$_closure5.doCall(BankEmployeeController.groovy:77)
at com.profiprog.asap.BankEmployeeController$_closure5.doCall(BankEmployeeController.groovy)
at com.profiprog.asap.security.AuthenticationUpdater.doFilter(AuthenticationUpdater.java:41)
at java.lang.Thread.run(Thread.java:662)

This exception occurs when message() is invoked from any action (even not transactional one). Like:

    def edit = {
        [
          bankEmployeeInstance: BankEmployee.get(params.id),
          title: message(code:'default.edit.label',args:["${message(messageEntityName)}"])
        ]
    }

Message can be invoked directly from action,
or inside string like "${message(code:'default.label')}".

Note: Also controller's code, generated by generate-controller, contains this kind of invoking message().

Workaround

Add prefix g. before every invocation of message() inside every controller's action:

    def edit = {
        [
          bankEmployeeInstance: BankEmployee.get(params.id),
          title: g.message(code:'default.edit.label',args:["${g.message(messageEntityName)}"])
        ]
    }
@pedjak
Copy link
Owner

pedjak commented Mar 14, 2011

Thanks for the report, I will investigate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant