Grails. Could not resolve view with name 'index' in servlet with name 'grailsDispatcherServlet'

Gerardo Tarragona picture Gerardo Tarragona · May 25, 2015 · Viewed 14k times · Source

I'm getting started with Grails (3.x) Framework but I got stuck with this error while trying to render domain content to a view:

Error 500: Internal Server Error
URI /hello/index
Class javax.servlet.ServletException
Message: Could not resolve view with name 'index' in servlet with name 'grailsDispatcherServlet'

HelloController.groovy:

package helloworld   
class HelloController {

    def index() {
        def Person persona1 = new Person(firstName: "someone", lastName: "stuck", age: 21)
        [persona:persona1]
    }
}

Person.groovy:

package helloworld

class Person {
    String firstName
    String lastName
    int age
}

Answer

zoran119 picture zoran119 · May 25, 2015

Make sure that grails-app/views/hello/index.gsp file exists.