Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine Grails,AppEngine,jpa-初学者在使用Grails生成所有_Google App Engine_Grails_Jpa - Fatal编程技术网

Google app engine Grails,AppEngine,jpa-初学者在使用Grails生成所有

Google app engine Grails,AppEngine,jpa-初学者在使用Grails生成所有,google-app-engine,grails,jpa,Google App Engine,Grails,Jpa,我正试图通过以下几个教程,通过Google App Engine和JPA了解grails: 我有Grails1.3.0RC2和AppEngineSDK1.3.3,我使用的是Windows7。我尝试的步骤是: grails创建应用程序appname cd-appname grails安装插件appengine。当被问及jdo/jpa时,我会回答jpa。它似乎是自动安装gorm jpa插件的,尽管教程都建议手动安装gorm jpa grails安装插件gormjpa(以防万一) grail

我正试图通过以下几个教程,通过Google App Engine和JPA了解grails:

我有Grails1.3.0RC2和AppEngineSDK1.3.3,我使用的是Windows7。我尝试的步骤是:

  • grails创建应用程序appname
  • cd-appname
  • grails安装插件appengine
    。当被问及jdo/jpa时,我会回答jpa。它似乎是自动安装gorm jpa插件的,尽管教程都建议手动安装gorm jpa
  • grails安装插件gormjpa
    (以防万一)
  • grails创建域类测试。Person
  • 编辑
    grails app/domain/test/Person.groovy以添加名称和地址字段:

    package test
    import javax.persistence.*;
    
    // import com.google.appengine.api.datastore.Key;
    @Entity
    class Person implements Serializable {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      Long id
    
      @Basic
      String name
    
      @Basic
      String address
    
      static constraints = {
        id visible:false
      }
    }
    
  • grails生成所有test.Person

  • 在这最后一步中,我会遇到错误:

    C:\Users\John\Workspaces\STS\appname>grails generate-all test.Person
    Welcome to Grails 1.3.0.RC2 - http://grails.org/
    Licensed under Apache Standard License 2.0
    Grails home is set to: C:\Users\John\Downloads\grails-1.3.0.RC2\grails-1.3.0.RC2
    
    Base Directory: C:\Users\John\Workspaces\STS\appname
    Resolving dependencies...
    Dependencies resolved in 493ms.
    Running script C:\Users\John\Downloads\grails-1.3.0.RC2\grails-1.3.0.RC2\scripts\GenerateAll.groovy
    Environment set to development
         [copy] Copied 4 empty directories to 2 empty directories under C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
         [copy] Copied 4 empty directories to 2 empty directories under C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
         [copy] Copied 1 empty directory to 1 empty directory under C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
        [mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
      [groovyc] Compiling 12 source files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
    Note: C:\Users\John\.grails\1.3.0.RC2\projects\appname\plugins\gorm-jpa-0.7.1\src\java\org\grails\jpa\domain\JpaGrailsDomainClass.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
      [groovyc] Compiling 8 source files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
        [mkdir] Created dir: C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\grails-app\i18n
    [native2ascii] Converting 13 files from C:\Users\John\Workspaces\STS\appname\grails-app\i18n to C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\grails-app\i18n
        [mkdir] Created dir: C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\plugins\gorm-jpa-0.7.1\grails-app\i18n
        [mkdir] Created dir: C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\plugins\app-engine-0.8.10\grails-app\i18n
    [native2ascii] Converting 1 file from C:\Users\John\.grails\1.3.0.RC2\projects\appname\plugins\gorm-jpa-0.7.1\grails-app\i18n to C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\plugins\gorm
    -jpa-0.7.1\grails-app\i18n
    [native2ascii] Converting 1 file from C:\Users\John\.grails\1.3.0.RC2\projects\appname\plugins\app-engine-0.8.10\grails-app\i18n to C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\plugins\a
    pp-engine-0.8.10\grails-app\i18n
         [copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
         [copy] Copying 2 files to C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
         [copy] Copied 2 empty directories to 2 empty directories under C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
         [copy] Copying 1 file to C:\Users\John\.grails\1.3.0.RC2\projects\appname
        [mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\plugins\app-engine-0.8.10
         [copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\plugins\app-engine-0.8.10
         [copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF
        [mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\lib
         [copy] Copying 64 files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\lib
    Configuring persistence for AppEngine
        [mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes\META-INF
         [copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes\META-INF
        [mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\plugins\app-engine-0.8.10
         [copy] Copying 2 files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\plugins\app-engine-0.8.10
        [mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\plugins\gorm-jpa-0.7.1
         [copy] Copying 2 files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\plugins\gorm-jpa-0.7.1
    Packaging AppEngine jar files
    Enhancing JDO classes
      [enhance] DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
      [enhance] DataNucleus Enhancer completed with success for 1 classes. Timings : input=589 ms, enhance=200 ms, total=789 ms. Consult the log for full details
      [groovyc] Compiling 1 source file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
         [copy] Copying 1 file to C:\Users\John\.grails\1.3.0.RC2\projects\appname
         [copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF
    Configuring persistence for AppEngine
    Packaging AppEngine jar files
    Enhancing JDO classes
      [enhance] DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
      [enhance] DataNucleus Enhancer completed with success for 1 classes. Timings : input=585 ms, enhance=28 ms, total=613 ms. Consult the log for full details
    Generating views for domain class test.Person ...
    java.lang.reflect.InvocationTargetException
            at SimpleTemplateScript1.run(SimpleTemplateScript1.groovy:43)
            at _GrailsGenerate_groovy.generateForDomainClass(_GrailsGenerate_groovy:85)
            at _GrailsGenerate_groovy$_run_closure1.doCall(_GrailsGenerate_groovy:50)
            at GenerateAll$_run_closure1.doCall(GenerateAll.groovy:42)
            at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
            at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
            at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
            at gant.Gant.withBuildListeners(Gant.groovy:427)
            at gant.Gant.this$2$withBuildListeners(Gant.groovy)
            at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
            at gant.Gant.dispatch(Gant.groovy:415)
            at gant.Gant.this$2$dispatch(Gant.groovy)
            at gant.Gant.invokeMethod(Gant.groovy)
            at gant.Gant.executeTargets(Gant.groovy:590)
            at gant.Gant.executeTargets(Gant.groovy:589)
    Caused by: java.lang.NoClassDefFoundError: org/hibernate/MappingException
            ... 15 more
    Caused by: java.lang.ClassNotFoundException: org.hibernate.MappingException
            at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:156)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:128)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
            ... 15 more
    Error running generate-all: null
    
    我做错了什么


    我应该查阅的详细信息的日志文件在哪里?

    似乎使用标准脚手架将可见性设置为false会导致错误。我不得不从这个区块中删除中间线,它成功了:

     static constraints = {
       id visible:false
     }
    
    我想这是“约定优于配置”的代价之一:隐藏的依赖关系。也可能是我还在学习