gpt4 book ai didi

google-app-engine - Grails,App Engine,JPA-初学者在Grails上遇到麻烦

转载 作者:行者123 更新时间:2023-12-02 14:09:45 24 4
gpt4 key购买 nike

我正在尝试通过遵循一些教程来了解Google App Engine和JPA的grails:

  • http://www.morkeleb.com/2009/08/12/grails-and-google-appengine-beginners-guide/
  • http://inhouse32.appspot.com/index.html
  • http://grails.org/plugin/app-engine

  • 我有grails 1.3.0 RC 2和App Engine SDK 1.3.3,并且我使用的是Windows7。我尝试的步骤是:
  • grails create-app appname
  • cd appname
  • grails install-plugin app-engine。当被问及jdo / jpa时,我会回答jpa。它似乎自动安装了gorm-jpa插件,尽管所有教程都建议手动安装gorm-jpa。
  • grails install-plugin gorm-jpa(以防万一)
  • grails create-domain-class test.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 generate-all 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
    }

    我想这是“配置之上的约定”的成本之一:隐藏的依赖关系。或者可能是我还在学习...

    关于google-app-engine - Grails,App Engine,JPA-初学者在Grails上遇到麻烦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2703892/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com