Announcement Announcement Module
No announcement yet.
Error in Grails STS 2.2.1 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error in Grails STS 2.2.1

    I am doing the tutorial in Grails A Quick Start Guide by Dave Klein published by Pragmatic Programmers. Here is the domain Class:

    class TekEvent {

    String city
    String name
    String organizer
    String venue
    Date startDate
    Date endDate
    String description

    String toString(){
    "$name, $city"

    static constraints = {


    And here is the BootStrap class:

    class BootStrap {

    def init = { servletContext ->
    def event1 = new TekEvent(name: 'Gateway Code Camp',
    city: 'Saint Louis, MO',
    organizer: 'John Doe',
    venue: 'TBD',
    startDate: new Date('9/19/2009'),
    endDate: new Date('9/19/2009'),
    description: '''This conference will bring coders from
    across platforms, languages, and industries
    together for an exciting day of tips, tricks,
    and tech! Stay sharp! Stay at the top of your
    game! But, don't stay home! Come an join us
    this fall for the first annual Gateway Code
    if (!{
    event1.errors.allErrors.each{error ->
    println "An error occured with event1: ${error}"

    def event2 = new TekEvent(name: 'Perl Before Swine',
    city: 'Austin, MN',
    organizer: 'John Deere',
    venue: 'SPAM Museum',
    startDate: new Date('9/1/2009'),
    endDate: new Date('9/1/2009'),
    description: '''Join the Perl programmers of the Pork Producers
    of America as we hone our skills and ham it up
    a bit. You can show off your programming chops
    while trying to win a year's supply of pork
    chops in our programming challenge.

    Come and join us in historic (and aromatic),
    Austin, Minnesota. You'll know when you're
    if (!{
    event2.errors.allErrors.each{error ->
    println "An error occured with event2: ${error}"

    def destroy = {

    This works fine from command line. However, the Bootstrap class has the following two errors in STS 2.2.1 environment:

    Groovy:unable to resolve class TekEvent - Line 4
    Groovy:unable to resolve class TekEvent - Line 23.

    I do a run-app from within Eclipse. It warns me that errors exist should I run it? I say yes, it runs it and everything is fine. It seems like it cannot resolve the dependency somehow.


  • #2
    Try putting your domain classes in a package and add an import statement at the top of your bootstrap class, like this:

    package foobar
    class TekEvent {
    import foobar.*
    class BootStrap {
    Eclipse has difficulties with classes in the default package


    • #3
      Thank you.


      • #4
        I can confirm this solution

        For your convenience be aware, that there's no need to add the package structure manually. Just use the context menu and click Refactor ... Move... and add a package name then. That's all.