This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Groovy and the fly likes MissingMethodException Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "MissingMethodException Error" Watch "MissingMethodException Error" New topic
Author

MissingMethodException Error

Dan King
Ranch Hand

Joined: Mar 18, 2009
Posts: 84
I recently started learning grails/groovy - reading along with "Grails: A Quick Start Guide"; I've run into this error which has got me stumped. Anyone know what's wrong? Following is the error message:

Error 500: groovy.lang.MissingMethodException: No signature of method: TechEvent.get() is applicable for argument types: (java.lang.String, java.lang.String) values: [1, ]
Servlet: grails
URI: /TechDays/grails/message/save.dispatch
Exception Message: No signature of method: TechEvent.get() is applicable for argument types: (java.lang.String, java.lang.String) values: [1, ]
Caused by: groovy.lang.MissingMethodException: No signature of method: TechEvent.get() is applicable for argument types: (java.lang.String, java.lang.String) values: [1, ]
Class: MessageController
At Line: [100]
Code Snippet:
99: def save = {
100: def messageInstance = new Message(params)
101: if(!messageInstance.hasErrors() && messageInstance.save()) {
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I know why this is happening but without seeing your Message and TechEvent domains I can't really explain it to you and tell you how to fix it. Basically, for some reason, when Message(params) does it's stuff, it is trying to get a TechEvent using 2 String parameters. The get method in GORM usually accepts an Integer which would be the ID of the object you need or an Object, but not a String, and not 2 Strings. Can you show us your domain classes?


GenRocket - Experts at Building Test Data
Dan King
Ranch Hand

Joined: Mar 18, 2009
Posts: 84
Gregg Bolinger wrote:...Can you show us your domain classes?


Message domain:


TechEvent domain:
Dan King
Ranch Hand

Joined: Mar 18, 2009
Posts: 84
Gregg Bolinger wrote:Basically, for some reason, when Message(params) does it's stuff, it is trying to get a TechEvent using 2 String parameters. The get method in GORM usually accepts an Integer which would be the ID of the object you need or an Object, but not a String, and not 2 Strings...


The issue was a hidden field in a form within my gsp, which duplicated an active field; thus upon submission it would send two arguments for the same parameter. I removed the hidden field and it now almost works. While I am now able to create a "new" message, when I try to "reply" I get the following error, which seems to be a grails bug:


Error 500: java.lang.ClassCastException: TechEvent$__clinit__closure1 cannot be cast to java.util.Map
Servlet: grails
URI: /TechDays/grails/message/save.dispatch
Exception Message: TechEvent$__clinit__closure1 cannot be cast to java.util.Map
Caused by: java.lang.ClassCastException: TechEvent$__clinit__closure1 cannot be cast to java.util.Map
Class: MessageController
At Line: [100]
Code Snippet:

99: def save = {
100: def messageInstance = new Message(params)
101: if(!messageInstance.hasErrors() && messageInstance.save()) {

 
Consider Paul's rocket mass heater.
 
subject: MissingMethodException Error
 
Similar Threads
How to compute delta time and lines per second when reinventing findstr/find/grep
grails and spatial data (custom type)
Grails Random
Grails: how is persisting of domain classes unit-tested?
Very basic question regarding example on p135/136 of the GIA book