Friday, May 27, 2011

Re: GWT and OpenJPA not working together

If you wan't to use JPA with AppEngine, you have to use the JPA that
comes with AppEngine which is based on datanucleus. See

http://code.google.com/appengine/docs/java/datastore/jpa/overview.html

for an overview

On Fri, May 27, 2011 at 5:56 AM, roman <roman.zangl@gmail.com> wrote:
> Hi,
> I'm trying to implement a UserManagement based on GoogleWebToolkit
> (Adding, deleting, assigning privileged; nothing special there). The
> GWT-module is using a serparate persistence module, which I included
> as a jar-file and which is based on OpenJPA.
>
> The persistence layer is working fine as long is I run it standalone.
> But when I wire it to my GWT project, I can't create the
> EntityManagerFactory any more. I get a NullPointerException in one of
> the OpenJPA classes, which I think is because that Google App Engine
> replaced the default java.lang.ClassLoader.
>
> Is it a bad idea to use OpenJPA with GWT? Is there anything to
> consider when combining these libraries?
>
> For better understanding find the source code attached.
> Any help would be greatly appreciated.
> thx, roman
>
> The server is running at http://localhost:8888/
> [WARN] Error for /usermgmtui/userInformation
> java.lang.ExceptionInInitializerError
>        at org.apache.openjpa.kernel.Bootstrap.invokeFactory(Bootstrap.java:
> 116)
>        at
> org.apache.openjpa.kernel.Bootstrap.getBrokerFactory(Bootstrap.java:
> 96)
>        at
> org.apache.openjpa.persistence.OpenJPAPersistence.getEntityManagerFactory(OpenJPAPersistence.java:
> 92)
>        at
> com.mycompany.commons.jpa.JpaUserManagement.<init>(JpaUserManagement.java:
> 64)
>        at
> com.mycompany.commons.UserManagementImpl.setDatasoure(UserManagementImpl.java:
> 71)
>        at
> com.mycompany.ui.server.UserInformationServiceImpl.<init>(UserInformationServiceImpl.java:
> 36)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
> Source)
>        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
> Source)
>        at java.lang.reflect.Constructor.newInstance(Unknown Source)
>        at java.lang.Class.newInstance0(Unknown Source)
>        at java.lang.Class.newInstance(Unknown Source)
>        at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
>        at
> org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:
> 428)
>        at
> org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:
> 339)
>        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> 487)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1166)
>        at
> com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:
> 35)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
> 58)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
> 43)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
> 122)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:
> 94)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> 388)
>        at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> 216)
>        at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> 182)
>        at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> 765)
>        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> 418)
>        at
> com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
> 70)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 152)
>        at com.google.appengine.tools.development.JettyContainerService
> $ApiProxyHandler.handle(JettyContainerService.java:351)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 152)
>        at org.mortbay.jetty.Server.handle(Server.java:326)
>        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> 542)
>        at org.mortbay.jetty.HttpConnection
> $RequestHandler.content(HttpConnection.java:938)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>        at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> 409)
>        at org.mortbay.thread.QueuedThreadPool
> $PoolThread.run(QueuedThreadPool.java:582)
> Caused by: java.lang.reflect.UndeclaredThrowableException
>        at $Proxy29.recordAppClassLoader(Unknown Source)
>        at
> com.google.appengine.tools.development.agent.runtime.Runtime.recordClassLoader(Runtime.java:
> 47)
>        at
> org.apache.openjpa.lib.util.MultiClassLoader.<init>(MultiClassLoader.java:
> 60)
>        at org.apache.openjpa.lib.util.J2DoPrivHelper
> $47.run(J2DoPrivHelper.java:1011)
>        at org.apache.openjpa.lib.util.J2DoPrivHelper
> $47.run(J2DoPrivHelper.java:1009)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at
> org.apache.openjpa.lib.conf.ProductDerivations.<clinit>(ProductDerivations.java:
> 59)
>        ... 44 more
> Caused by: java.lang.reflect.InvocationTargetException
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>        at java.lang.reflect.Method.invoke(Unknown Source)
>        at com.google.apphosting.utils.clearcast.ClearCast$CasterImpl
> $ProxyHandler.invoke(ClearCast.java:411)
>        ... 51 more
> Caused by: java.lang.NullPointerException
>        at
> org.apache.openjpa.lib.util.MultiClassLoader.hashCode(MultiClassLoader.java:
> 277)
>        at java.util.WeakHashMap.put(Unknown Source)
>        at
> com.google.appengine.tools.development.agent.impl.AgentImpl.recordAppClassLoader(AgentImpl.java:
> 34)
>        ... 56 more
> [WARN] Nested in java.lang.ExceptionInInitializerError:
> java.lang.reflect.UndeclaredThrowableException
>        at $Proxy29.recordAppClassLoader(Unknown Source)
>        at
> com.google.appengine.tools.development.agent.runtime.Runtime.recordClassLoader(Runtime.java:
> 47)
>        at
> org.apache.openjpa.lib.util.MultiClassLoader.<init>(MultiClassLoader.java:
> 60)
>        at org.apache.openjpa.lib.util.J2DoPrivHelper
> $47.run(J2DoPrivHelper.java:1011)
>        at org.apache.openjpa.lib.util.J2DoPrivHelper
> $47.run(J2DoPrivHelper.java:1009)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at
> org.apache.openjpa.lib.conf.ProductDerivations.<clinit>(ProductDerivations.java:
> 59)
>        at org.apache.openjpa.kernel.Bootstrap.invokeFactory(Bootstrap.java:
> 116)
>        at
> org.apache.openjpa.kernel.Bootstrap.getBrokerFactory(Bootstrap.java:
> 96)
>        at
> org.apache.openjpa.persistence.OpenJPAPersistence.getEntityManagerFactory(OpenJPAPersistence.java:
> 92)
>        at
> com.mycompany.commons.jpa.JpaUserManagement.<init>(JpaUserManagement.java:
> 64)
>        at
> com.mycompany.commons.UserManagementImpl.setDatasoure(UserManagementImpl.java:
> 71)
>        at
> com.mycompany.ui.server.UserInformationServiceImpl.<init>(UserInformationServiceImpl.java:
> 36)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
> Source)
>        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
> Source)
>        at java.lang.reflect.Constructor.newInstance(Unknown Source)
>        at java.lang.Class.newInstance0(Unknown Source)
>        at java.lang.Class.newInstance(Unknown Source)
>        at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
>        at
> org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:
> 428)
>        at
> org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:
> 339)
>        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> 487)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1166)
>        at
> com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:
> 35)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
> 58)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
> 43)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
> 122)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:
> 94)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> 388)
>        at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> 216)
>        at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> 182)
>        at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> 765)
>        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> 418)
>        at
> com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
> 70)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 152)
>        at com.google.appengine.tools.development.JettyContainerService
> $ApiProxyHandler.handle(JettyContainerService.java:351)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 152)
>        at org.mortbay.jetty.Server.handle(Server.java:326)
>        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> 542)
>        at org.mortbay.jetty.HttpConnection
> $RequestHandler.content(HttpConnection.java:938)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>        at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> 409)
>        at org.mortbay.thread.QueuedThreadPool
> $PoolThread.run(QueuedThreadPool.java:582)
> Caused by: java.lang.reflect.InvocationTargetException
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>        at java.lang.reflect.Method.invoke(Unknown Source)
>        at com.google.apphosting.utils.clearcast.ClearCast$CasterImpl
> $ProxyHandler.invoke(ClearCast.java:411)
>        ... 51 more
> Caused by: java.lang.NullPointerException
>        at
> org.apache.openjpa.lib.util.MultiClassLoader.hashCode(MultiClassLoader.java:
> 277)
>        at java.util.WeakHashMap.put(Unknown Source)
>        at
> com.google.appengine.tools.development.agent.impl.AgentImpl.recordAppClassLoader(AgentImpl.java:
> 34)
>        ... 56 more
>
>
> java.lang.NoClassDefFoundError: Could not initialize class
> org.apache.openjpa.lib.conf.ProductDerivations
>        at org.apache.openjpa.kernel.Bootstrap.invokeFactory(Bootstrap.java:
> 116)
>        at
> org.apache.openjpa.kernel.Bootstrap.getBrokerFactory(Bootstrap.java:
> 96)
>        at
> org.apache.openjpa.persistence.OpenJPAPersistence.getEntityManagerFactory(OpenJPAPersistence.java:
> 92)
>        at
> com.mycompany.commons.commons.jpa.JpaUserManagement.<init>(JpaUserManagement.java:
> 64)
>        at
> com.mycompany.commons.commons.UserManagementImpl.setDatasoure(UserManagementImpl.java:
> 71)
>        at
> com.mycompany.commons.ui.server.UserInformationServiceImpl.<init>(UserInformationServiceImpl.java:
> 36)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
> Source)
>        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
> Source)
>        at java.lang.reflect.Constructor.newInstance(Unknown Source)
>        at java.lang.Class.newInstance0(Unknown Source)
>        at java.lang.Class.newInstance(Unknown Source)
>        at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
>        at
> org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:
> 428)
>        at
> org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:
> 339)
>        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> 487)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1166)
>        at
> com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:
> 35)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
> 58)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
> 43)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
> 122)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:
> 94)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> 388)
>        at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> 216)
>        at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> 182)
>        at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> 765)
>        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> 418)
>        at
> com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
> 70)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 152)
>        at com.google.appengine.tools.development.JettyContainerService
> $ApiProxyHandler.handle(JettyContainerService.java:351)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 152)
>        at org.mortbay.jetty.Server.handle(Server.java:326)
>        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> 542)
>        at org.mortbay.jetty.HttpConnection
> $RequestHandler.content(HttpConnection.java:938)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>        at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> 409)
>        at org.mortbay.thread.QueuedThreadPool
> $PoolThread.run(QueuedThreadPool.java:582)
>
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment