Announcement Announcement Module
Collapse
No announcement yet.
STS 2.9.1 Generate Controller and Views fails Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • STS 2.9.1 Generate Controller and Views fails

    (Q) What am I doing wrong?

    I'm using STS 2.9.1 and playing with some basics (just learning Grails).

    To experiment, I tried generating a Controller using both STS and grails command line shown below and
    I get the error shown below.

    Thanks,
    PatS

    -------------------------------------------------
    cd c:\mygrailsproj
    grails
    generate-controller --stacktrace bar

    | Compiling 1 source files....
    | Compiling 1 source files....
    | No domain class found for name Foo1. Please try again and enter a valid domain class name
    | Error Error running script generate-controller foo1: org.codehaus.groovy.grails.cli.ScriptExitException (Use --stacktrace
    | Compiling 1 source files.....
    | Compiling 1 source files.....
    | No domain class found for name Bar. Please try again and enter a valid domain class name
    | Error Error running script generate-controller --stacktrace bar: org.codehaus.groovy.grails.cli.ScriptExitException (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
    org.codehaus.groovy.grails.cli.ScriptExitException
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrConstructorNewInstance(ReflectiveInterceptor.jav a:963)
    at _GrailsSettings_groovy$_run_closure4.doCall(_Grail sSettings_groovy:141)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantM etaClass.java:133)
    at _GrailsGenerate_groovy$_run_closure1.doCall(_Grail sGenerate_groovy:53)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantM etaClass.java:133)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantM etaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBindi ng_closure5_closure16_closure18.doCall(GantBinding .groovy:1
    85)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at org.codehaus.gant.GantBinding$_initializeGantBindi ng_closure5_closure16_closure18.doCall(GantBinding .groovy)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at java_util_concurrent_Callable$call.call(Unknown Source)
    at org.codehaus.gant.GantBinding.withTargetEvent(Gant Binding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEve nt(GantBinding.groovy)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at org.codehaus.gant.GantBinding$_initializeGantBindi ng_closure5_closure16.doCall(GantBinding.groovy:18 5)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at org.codehaus.gant.GantBinding$_initializeGantBindi ng_closure5_closure16.doCall(GantBinding.groovy)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantM etaClass.java:133)
    at GenerateController$_run_closure1.doCall(GenerateCo ntroller.groovy:33)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantM etaClass.java:133)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantM etaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBindi ng_closure5_closure16_closure18.doCall(GantBinding .groovy:1
    85)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at org.codehaus.gant.GantBinding$_initializeGantBindi ng_closure5_closure16_closure18.doCall(GantBinding .groovy)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at java_util_concurrent_Callable$call.call(Unknown Source)
    at org.codehaus.gant.GantBinding.withTargetEvent(Gant Binding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEve nt(GantBinding.groovy)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at org.codehaus.gant.GantBinding$_initializeGantBindi ng_closure5_closure16.doCall(GantBinding.groovy:18 5)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at org.codehaus.gant.GantBinding$_initializeGantBindi ng_closure5_closure16.doCall(GantBinding.groovy)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at java_util_concurrent_Callable$call.call(Unknown Source)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:38 1)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:41 5)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at java_util_concurrent_Callable$call.call(Unknown Source)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Un known Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:591)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1237)
    at gant.Gant.executeTargets(Gant.groovy:590)
    at com.springsource.loaded.ri.ReflectiveInterceptor.j lrMethodInvoke(ReflectiveInterceptor.java:1231)
    | Error Error running script generate-controller --stacktrace bar: org.codehaus.groovy.grails.cli.ScriptExitException
    -------------------------------------------------

  • #2
    I think that the generate-controller command assumes you are generating the controller *for* a particular domain class.
    So you need to first create the domain class.

    "grails create-domain-class Bar".
    Then "grails generate-contoller Bar".

    Typically before you generate the controller. You would probably add some things to the domain classes (some fields to represent that data of this domain object).

    Kris

    Comment


    • #3
      This worked.
      I played around with grails around a year ago and I'm relearning how it works.

      Sorry for the basic question and thanks for the kind reply.

      Comment

      Working...
      X