appengine generating resources for JPA entity

15 views
Skip to first unread message

Niko

unread,
Sep 21, 2009, 6:44:20 PM9/21/09
to grails-jaxrs
Hi together:

First let say me a big thanks for creating the jax-rs project for
Grails!

I was hoping to get jaxrs 0.2 together with appengine 0.8.5 and gorm-
jpa 0.5 plugins working together for Grails 1.1.1. Unfortunately the
persistence provider cannot found (see stacktrace below).

My first guess is that grails-app/conf/persistence.xml (where the
transactions-optional persistence unit is declared) cannot be located
on the classpath. Any ideas or hints highly appreciated.

Thanks,
Niko

$ grails generate-resources person
Welcome to Grails 1.1.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /Users/niko/DevTools/grails-1.1.1

Base Directory: /Users/niko/sandbox/grails-playground/mybag
Running script /Users/niko/.grails/1.1.1/projects/mybag/plugins/
jaxrs-0.2/scripts/GenerateResources.groovy
Environment set to development
[copy] Copying 1 file to /Users/niko/.grails/1.1.1/projects/mybag
[copy] Copying 1 file to /Users/niko/.grails/1.1.1/projects/mybag
[copy] Copying 1 file to /Users/niko/.grails/1.1.1/projects/mybag
[copy] Copying 1 file to /Users/niko/.grails/1.1.1/projects/mybag
Error executing script GenerateResources: null
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at AppEngineGrailsPlugin$_closure1.class$
(AppEngineGrailsPlugin.groovy)
at AppEngineGrailsPlugin$_closure1.$get$$class$org$grails$appengine
$AppEngineEntityManagerFactory(AppEngineGrailsPlugin.groovy)
at AppEngineGrailsPlugin$_closure1.doCall
(AppEngineGrailsPlugin.groovy:70)
at AppEngineGrailsPlugin$_closure1.doCall
(AppEngineGrailsPlugin.groovy)
at grails.spring.BeanBuilder.invokeBeanDefiningClosure
(BeanBuilder.java:651)
at grails.spring.BeanBuilder.beans(BeanBuilder.java:501)
at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:447)
at _GrailsBootstrap_groovy$_run_closure2_closure13.doCall
(_GrailsBootstrap_groovy:86)
at _GrailsBootstrap_groovy$_run_closure2_closure13.doCall
(_GrailsBootstrap_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall
(_GrailsSettings_groovy:274)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _GrailsBootstrap_groovy$_run_closure2.doCall
(_GrailsBootstrap_groovy:84)
at _GrailsBootstrap_groovy$_run_closure7.doCall
(_GrailsBootstrap_groovy:142)
at GenerateResources$_run_closure2.doCall(GenerateResources:55)
at GenerateResources$_run_closure1.doCall(GenerateResources:43)
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:344)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:334)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:495)
at gant.Gant.processTargets(Gant.groovy:480)
Caused by: javax.persistence.PersistenceException: No Persistence
provider for EntityManager named transactions-optional
at javax.persistence.Persistence.createEntityManagerFactory
(Persistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory
(Persistence.java:33)
at javax.persistence.Persistence$createEntityManagerFactory.call
(Unknown Source)
at org.grails.appengine.AppEngineEntityManagerFactory.<clinit>
(AppEngineEntityManagerFactory.groovy:13)
... 28 more

Martin Krasser

unread,
Sep 22, 2009, 3:52:18 AM9/22/09
to grails...@googlegroups.com
Niko schrieb:
> Hi together:
>
> First let say me a big thanks for creating the jax-rs project for
> Grails!
>
Thank you for giving it try!
> I was hoping to get jaxrs 0.2 together with appengine 0.8.5 and gorm-
> jpa 0.5 plugins working together for Grails 1.1.1. Unfortunately the
> persistence provider cannot found (see stacktrace below).
>
> My first guess is that grails-app/conf/persistence.xml (where the
> transactions-optional persistence unit is declared) cannot be located
> on the classpath. Any ideas or hints highly appreciated.
>
Even if the gorm-jpa is not installed (only the appengine plugin) I also
get an error when running generate-resources. Seems that there's
something wrong with bootstrapping the appengine plugin from a script.
What you could try is to generate-resources on a clean project and then
install the appengine and grom-jpa plugins later. I'm curious about your
experiments - please let me know if you make any progress here.

I hope to find some time in the near future to make some further
investigations here.

Cheers,
Martin

Niko

unread,
Sep 23, 2009, 5:50:12 PM9/23/09
to grails-jaxrs
This time I took a step back, and just tried to deploy an app with
appengine (0.8.5) and jax-rs (0.2) plugin installed on Grails 1.1.1
without any resources at all

I put into conf/Config.groovy as described on the google code wiki
org.grails.jaxrs.provider.name='restlet'

And get a long stack trace on appengine log - seems related to
org.grails.jaxrs.web.JaxrsContext#init()

java.lang.reflect.GenericSignatureFormatError
at sun.reflect.generics.parser.SignatureParser.error(Unknown Source)
at sun.reflect.generics.parser.SignatureParser.parseClassTypeSignature
(Unknown Source)
at sun.reflect.generics.parser.SignatureParser.parseClassSignature
(Unknown Source)
at sun.reflect.generics.parser.SignatureParser.parseClassSig(Unknown
Source)
at sun.reflect.generics.repository.ClassRepository.parse(Unknown
Source)
at sun.reflect.generics.repository.ClassRepository.parse(Unknown
Source)
at sun.reflect.generics.repository.AbstractRepository.<init>(Unknown
Source)
at sun.reflect.generics.repository.GenericDeclRepository.<init>
(Unknown Source)
at sun.reflect.generics.repository.ClassRepository.<init>(Unknown
Source)
at sun.reflect.generics.repository.ClassRepository.make(Unknown
Source)
at java.lang.Class.getGenericInfo(Unknown Source)
at java.lang.Class.getTypeParameters(Unknown Source)
at
sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments
(Unknown Source)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>
(Unknown Source)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make
(Unknown Source)
at
sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType
(Unknown Source)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature
(Unknown Source)
at sun.reflect.generics.tree.ClassTypeSignature.accept(Unknown
Source)
at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Unknown
Source)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature
(Unknown Source)
at sun.reflect.generics.tree.ClassTypeSignature.accept(Unknown
Source)
at sun.reflect.generics.repository.ClassRepository.getSuperclass
(Unknown Source)
at java.lang.Class.getGenericSuperclass(Unknown Source)
at com.sun.jersey.core.reflection.ReflectionHelper.resolveTypeVariable
(ReflectionHelper.java:441)
at com.sun.jersey.core.reflection.ReflectionHelper.resolveTypeVariable
(ReflectionHelper.java:447)
at com.sun.jersey.core.reflection.ReflectionHelper.resolveTypeVariable
(ReflectionHelper.java:447)
at com.sun.jersey.core.reflection.ReflectionHelper.resolveTypeVariable
(ReflectionHelper.java:425)
at
com.sun.jersey.core.reflection.ReflectionHelper.getParameterizedClassArguments
(ReflectionHelper.java:296)
at com.sun.jersey.core.spi.factory.MessageBodyFactory
$DistanceComparator.getDistance(MessageBodyFactory.java:131)
at com.sun.jersey.core.spi.factory.MessageBodyFactory
$DistanceComparator.compare(MessageBodyFactory.java:119)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at java.util.Collections.sort(Unknown Source)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders
(MessageBodyFactory.java:162)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.init
(MessageBodyFactory.java:145)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate
(WebApplicationImpl.java:609)
at com.sun.jersey.spi.spring.container.servlet.SpringServlet.initiate
(SpringServlet.java:97)
at com.sun.jersey.spi.container.servlet.ServletContainer
$InternalWebComponent.initiate(ServletContainer.java:242)
at com.sun.jersey.spi.container.servlet.WebComponent.load
(WebComponent.java:455)
at com.sun.jersey.spi.container.servlet.WebComponent.init
(WebComponent.java:178)
at com.sun.jersey.spi.container.servlet.ServletContainer.init
(ServletContainer.java:281)
at com.sun.jersey.spi.container.servlet.ServletContainer.init
(ServletContainer.java:442)
at javax.servlet.GenericServlet.init(GenericServlet.java:215)
at org.grails.jaxrs.web.JaxrsContext.init(JaxrsContext.java:132)
at org.grails.jaxrs.web.JaxrsContext.init(JaxrsContext.java:121)
at org.grails.jaxrs.web.JaxrsListener.contextInitialized
(JaxrsListener.java:45)
at org.mortbay.jetty.handler.ContextHandler.startContext
(ContextHandler.java:530)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
at org.mortbay.jetty.webapp.WebAppContext.startContext
(WebAppContext.java:1218)
at org.mortbay.jetty.handler.ContextHandler.doStart
(ContextHandler.java:500)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:
448)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:40)
at
com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler
(AppVersionHandlerMap.java:190)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler
(AppVersionHandlerMap.java:167)
at
com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest
(JettyServletEngineAdapter.java:127)
at com.google.apphosting.runtime.JavaRuntime.handleRequest
(JavaRuntime.java:235)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:4950)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:4948)
at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest
(BlockingApplicationHandler.java:24)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:
359)
at com.google.net.rpc.impl.Server$2.run(Server.java:823)
at com.google.tracing.LocalTraceSpanRunnable.run
(LocalTraceSpanRunnable.java:56)
at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan
(LocalTraceSpanBuilder.java:516)
at com.google.net.rpc.impl.Server.startRpc(Server.java:778)
at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
at com.google.net.rpc.impl.ServerConnection.messageReceived
(ServerConnection.java:437)
at com.google.net.rpc.impl.RpcConnection.parseMessages
(RpcConnection.java:319)
at com.google.net.rpc.impl.RpcConnection.dataReceived
(RpcConnection.java:290)
at com.google.net.async.Connection.handleReadEvent(Connection.java:
428)
at com.google.net.async.EventDispatcher.processNetworkEvents
(EventDispatcher.java:762)
at com.google.net.async.EventDispatcher.internalLoop
(EventDispatcher.java:207)
at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:
101)
at com.google.net.rpc.RpcService.runUntilServerShutdown
(RpcService.java:251)
at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run
(JavaRuntime.java:392)
at java.lang.Thread.run(Unknown Source)

Martin Krasser

unread,
Sep 24, 2009, 6:50:26 AM9/24/09
to grails...@googlegroups.com
Hi Niko,

my latest tests were with appengine 0.8.3 plugin; hope to find some time
today to make tests again with appengine 0.8.5 plugin - I'll let you
know then.

Which appengine SDK do you use? Do you get the same error when deploying
the sample application as described in the docs?

Niko schrieb:

Martin Krasser

unread,
Sep 24, 2009, 11:46:57 AM9/24/09
to grails...@googlegroups.com
didn't look carefully enough at the stacktrace before: The problem is
that your app still uses Jersey i.e. something went wrong with
configuring Restlet. I just tried to run your scenario again - and it
works. Can you please check whether the created war file (target/war)
contains the correct Config.groovy? Can you also send me the whole
content of Config.groovy for review?


Niko schrieb:
Reply all
Reply to author
Forward
0 new messages