Groovy console for Grails does not work

Answered

Steps to demonstrate the problem:

  • Create a new Grails project: untitled
  • Create a new Grails domain class: Widget
  • Give it one class attribute: name
  • Run Grails command: `generate-all Widget`
  • Debug the application
  • Notice that you can create, list, and delete Widgets (i.e., the default H2 database and GORM are working)
  • Use Tools, Groovy Console...
  • Change the class path to untitled_main
  • Type `def ws=Widget.findAll()`
  • Notice that it automatically adds `import untitled.Widget` to the top of the console listing
  • Run the script

Get the error: "java.lang.IllegalStateException: Either class [untitled.Widget] is not a domain class or Form has not been initialized correctly or has already been shutdown."

What needs to happen to make the console work with a Grails application (and GORM)?

0
2 comments

Indeed, that seems like the exact same problem. Also, it looks like that bug is about to celebrate it's second birthday, even though it has many "related issues," so I guess this isn't getting fixed any time soon?

0

Please sign in to leave a comment.