Reputation: 3776
I have the following setup, grails 2.0.3, STS, and I'm doing this in one of my controllers:
render(['car': contactL] as JSON)
When I run the application I get the following error:
I have read about the error, but none of the solutions have worked for me, I have tried cleaning, upgrading, using the Grails Tools -> Refresh dependencies but it gave me:
grails> | Error Error running script null: Cannot invoke method trim() on null object (Use --stacktrace to see the full trace)
I'm also getting this error in my project:
The project was not built since its build path is incomplete. Cannot find the class file for groovy.lang.GroovyObject. Fix the build path then try building this project Ristretto Unknown Java Problem
What's you diagnose?
Upvotes: 3
Views: 7254
Reputation: 3776
I finally managed to get it working, I switched workspace, and added my project - problem solved.
Upvotes: -1
Reputation: 120286
To fix the "unable to resolve class JSON" error, you should just have to import it:
import grails.converters.JSON
...
class MyController {
...
render [car: contactL] as JSON
Upvotes: 13