I have a simple grails(2.0.3) application with a couple of domain models, controllers and services for them. After I saved it and try to run on another machine I get some strange behaviour.
Generated controller links on the index page look correct, but being clicked redirect me to localhost:8080/appname/appname with 404 instead of localhost:8080/appname/controller/action.
But when I try to manually recreate a model with "grails generate-domain-class", generate a controller and create a service class it works fine. It seems like some project data is lost after moving it, or perhaps it is stored somewhere outside my project folder.
What do I need to do to save my working project at 1st machine and reopen it at 2nd one? My application is created without using any IDE, just command line and text editor.
EDIT
After trying to reproduce this behaviour without posting all the unnecessary code got the same without moving project to another machine.
When I create a controller that uses injected service(after reading this):
class BookController {
def bookService
def index() {
redirect(action: "list", params: params)
}
def list() {
def result = bookService.list(params)
if(!result.error) {
return [ bookInstanceList: result.bookInstanceList,
bookInstanceTotal: result.bookInstanceTotal ]
}
flash.message = g.message(code: result.error.code, args: result.error.args)
redirect( url: resource(dir:'') )
}
}
and generate views I try to access generated controller url at index page and get localhost:8080/appname/appname with 404. No error messages displayed in grails console.