Sunday, August 7, 2011

grails detecting dependency conflicts

To find out what kind of dependency conflicts you might have in your grails application execute the following:


grails dependency-report

A conflict resulted when I had different versions of the slf4j api

Refernece: http://www.grails.org/doc/latest/ref/Command%20Line/dependency-report.html

grails No thread-bound request found

When attempting to save a Domain object outside of a web request (which is running in a forked thread),
I received the following error message:

No thread-bound request found

This has something to do with Grails thinking that the Domain object is a Command object, which is not true.

To workaround this issue, I  had to make some changes in the controller where the binding of the form parameters takes place.

Previously, I would bind parameters as follows:

def save = { MiddlewareCase mCase ->

...
       
}

Now to avoid the error, I do the following:

def save = { 
        
        // IMPORTANT!!! Must bind this way or we get "No thread-bound request found"        
        MiddlewareCase mCase = new MiddlewareCase();
        bindData(mCase, params)

}