Grails, app-engine, jpa - TargetInvocationException
Posted
by John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2010-04-24T09:19:10Z
Indexed on
2010/04/24
9:23 UTC
Read the original article
Hit count: 942
I'm trying to learn about grails with Google App Engine and JPA by following a few tutorials:
- 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
I've got grails 1.3.0 RC 2, and App Engine SDK 1.3.3, and I'm using Windows 7. The steps that I try are:
grails create-app appname
cd appname
grails install-plugin app-engine
. I answer jpa when asked about jdo/jpa. It appears to install the gorm-jpa plugin automatically, although the tutorials all suggest installing gorm-jpa manually.grails install-plugin gorm-jpa
(just in case)grails create-domain-class test.Person
Edit the
grails-app/domain/test/Person.groovy
to add name and address fields: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
I get errors during this final step:
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
What am I doing wrong?
© Stack Overflow or respective owner