views:

376

answers:

3

I'm trying to follow the grails tutorial here.

When I create a new controller using create-controller XXX.Card and modify it to use scaffolding as per the tutorial:

package XXX

class CardController {  
    def scaffold = Card
}

I get the following exception when I click on XXX.CardController:

org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: static XXX.Card.list() is applicable for argument types: (org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap) values: [[max:10, action:list, controller:card]]
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:54)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:121)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:54)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:342)
Caused by: groovy.lang.MissingMethodException: No signature of method: static XXX.Card.list() is applicable for argument types: (org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap) values: [[max:10, action:list, controller:card]]
    at XXX.CardController$_closure2.doCall(script1258397512682.groovy:14)
    at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:100)
    at XXX.CardController$_closure2.doCall(script1258397512682.groovy)
    at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:100)
    ... 5 more

I'm using Grails 1.1.1 with the app-engine 0.8.5 and gorm-jpa 0.5 plugins.

What am I doing wrong?

Here's the script I use to reproduce this problem:

rm -rf ~/.grails/1.1.1/projects/XXX
grails create-app XXX
cd XXX
grails install-plugin gorm-jpa
grails install-plugin app-engine # Note: specify JPA when prompted
grails create-domain-class XXX.Card
grails create-controller XXX.Card
cat > grails-app/controllers/XXX/CardController.groovy <<EOF
package XXX

class CardController {
    def scaffold = Card
}
EOF
cat > grails-app/domain/XXX/Card.groovy <<EOF
package XXX

class Card {

    List emails

    static hasMany = [emails:String]
}
EOF
grails app-engine
+1  A: 

I just re-created your scenario with the following steps, using Grails 1.1.1:

grails create-app XXX
cd XXX
grails create-domain-class XXX.Card
grails create-controller XXX.Card
-- Edited grails-app\Controllers\XXX\Card.groovy removing the index action and adding the scaffold declaration "def scaffold = Card"
grails run-app

When I visited http://localhost:8080/XXX/card, I was given the appropriate list page for the Card class (which had no entries, and no columns, since I hadn't added anything to Card)

Note the lowercase "card" (you seem to have it correct), this is important. Controller paths in the URL are defaulted to start with a lower case.

Hope this helps. If you can't follow these steps and get it to work, I'd look at those plugins you installed.

Bill James
+1  A: 

have you tried installing the gorm-jpa plugin? I don't think list() is implemented in the app-engine plugin, but rather in gorm-jpa.

jdo has no gorm support.

tomas
Ah, thank you. Good catch, I was missing that in my original. I've rewritten the problem description to include that plugin, which doesn't seem to have solved the problem. See above.
Mike
A: 

After some conversations on the forums, it appears that GORM is only lightly working with App Engine at this time. Until the next release of the various plugins involved (app-engine and gorm-jpa) it's probably best to stay away from GORM with App Engine.

Thanks for all the help, Tomas.

Mike