1

We keep getting the following error intermittently in production with grails. It says there is no get method for the given domain class. This happens once every few days on code that is executing about 300 times/minute. We haven't been able to reproduce it.

No signature of method: static DomainClass.get() is applicable for argument types: (java.lang.Long) values: [97]

Has anyone else ran into this problem? We are using grails 1.3.6. The id's on our domain classes are the gorm defaults. We are running the sun jvm version 1.6.0_17-b04.

Update:

I found out a little more when the error happened today. We are using the JMS grails plugin, and the error occurs in the one of the classes that is receiving JMS messages. It looks like the JMS plugin starts delivering messages before grails has finished bootstraping the application. If there are messages in the queue when grails starts, the exceptions start appearing in the log. Once grails has started all the way, the errors stop and the messages process normally. My guess is that the spring context inside grails is started before dynamic methods are added to the Domain classes.

Matt Campbell
  • 687
  • 1
  • 7
  • 17
  • For me, it happens when I change class code in debug env, but Grails fails to completely update class binary - so Grails runtime sticks with new class code but without injected methods. I believe, this is not your case, as class redeployment is off by default on production, and the next call works right (btw, does it?) Do you do anything with Grails classloaders? – Victor Sergienko Feb 18 '11 at 17:29
  • are you sure that your transferred argument type is Long all the time (if not, a conversion is surely needed)? If yes, a "grails clean" may solve your problem. – Hoàng Long Feb 19 '11 at 02:02
  • could you give some code about the domain class and how you use .get() ? It may help locating the problem. – Hoàng Long Feb 19 '11 at 02:10
  • I'm sure the code always passes a long. The error message says there is no get method that takes a long. I'll see if I can get the code up. I've been pulled into other things. As for cleaning, this is happening running in Tomcat in our UAT environment. Our build server builds the war files with grails clean war. – Matt Campbell Feb 22 '11 at 23:52

2 Answers2

0

You might be running into this issue

http://jira.codehaus.org/browse/GRAILS-4467

what is a bit weird is how this only happens every so often. Are you sure the actual method that is failing is being called that often?

hvgotcodes
  • 118,147
  • 33
  • 203
  • 236
  • I looked at the jira, and that isn't our case. This is for sure only happens occasionally, which is what makes it so perplexing. – Matt Campbell Feb 22 '11 at 23:55
0

As you said that your id for the domain class is GORM default, so the bug in Grails Jira that hvgotcodes points out doesn't apply in your case (they deal with string id).

I guess that it's maybe at somewhere, the argument transfered into get() method is not "Long type". It's very easy to miss, for example, the parameter 'id' transfered by GET/POST method (GORM default) is string type, and need to be converted to Long before using.

For example:

def id = params.id
def object = DomainClass.get(id as Long)
Hoàng Long
  • 10,746
  • 20
  • 75
  • 124