After I created a new Class using:
grails> create-domain-class User
I want to to generate the controller:
grails>generate-all User
I got these error:
| No domain class found for name User. Please try again and enter a valid domain class name
| Error Error running generate-all (Use –stacktrace to see the full trace)
| Error Error running script generate-all User: org.codehaus.groovy.grails.cli.ScriptExitException (
Use –stacktrace to see the full trace)
grails> –stacktrace
| Error Error running script –stacktrace: Cannot invoke method findAll() on null object (NOTE: Stac
k trace has been filtered. Use –verbose to see entire trace.)
java.lang.NullPointerException: Cannot invoke method findAll() on null object
at RunApp$_run_closure8_closure13.doCall(RunApp:229)
at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.ja
va:1231)
at RunApp$_run_closure8_closure13.doCall(RunApp)
at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.ja
va:1231)
| Error Error running script –stacktrace: Cannot invoke method findAll() on null object
The solution is use the class full name:
generate-all helloworld.User
helloworld is my application name. and the User class package is “hellowolrd”.
Many thanks for: generate-all No domain class found for.. error in grails
Grails: Hello world! <->
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.