Google App Engine 1.7.5 - org.datanucleus.exceptions.ClassNotResolvedException

时间:2013-03-08 15:22:51

标签: google-app-engine jpa

我使用Google应用引擎-GAE创建了一个示例GWT应用,我创建了一个实体并将其保存在服务层,工作正常,数据存储。

所以当我尝试创建EntityManager时,我开始在服务层添加小部件和更多类,我得到:

org.datanucleus.exceptions.ClassNotResolvedException对于非实体类,例如一个小部件,我不知道为什么Datanucleus正在尝试增强没有@Entity注释的类。

我在ORM下配置了Google Plugin Eclipse,只增强了dto包中的bean并删除了/ src条目。

它永远不会工作,我只需要告诉DN不要只增强它看到它的CLASSPATH的所有类。

任何帮助都将被评估。

我正在使用GAE版本1.7.5和GWT 2.5和GXT 2.5.5。

例外:

Initializing App Engine server
Mar 8, 2013 5:07:51 PM com.google.apphosting.utils.config.EarHelper logNotAnEar
INFO: Directory 'C:\dev\projects\org\me\workspace\lottoshop\war' is not an EAR directory. File C:\dev\projects\org\me\workspace\lottoshop\war\appengine-application.xmlappengine-application.xml not detected.
Mar 8, 2013 5:07:51 PM com.google.apphosting.utils.config.EarHelper logNotAnEar
INFO: Directory 'C:\dev\projects\org\me\workspace\lottoshop\war' is not an EAR directory. File C:\dev\projects\org\me\workspace\lottoshop\war\appengine-application.xmlappengine-application.xml not detected.
Mar 8, 2013 5:07:51 PM com.google.apphosting.utils.config.EarHelper logNotAnEar
INFO: Directory 'C:\dev\projects\org\me\workspace\lottoshop\war' is not an EAR directory. File C:\dev\projects\org\me\workspace\lottoshop\war\appengine-application.xmlappengine-application.xml not detected.
Mar 8, 2013 5:07:51 PM com.google.apphosting.utils.config.EarHelper logNotAnEar
INFO: Directory 'C:\dev\projects\org\me\workspace\lottoshop\war' is not an EAR directory. File C:\dev\projects\org\me\workspace\lottoshop\war\appengine-application.xmlappengine-application.xml not detected.
Mar 8, 2013 5:07:51 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed C:\dev\projects\org\me\workspace\lottoshop\war\WEB-INF/appengine-web.xml
Mar 8, 2013 5:07:51 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed C:\dev\projects\org\me\workspace\lottoshop\war\WEB-INF/web.xml
Mar 8, 2013 5:07:51 PM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties
INFO: Overwriting system property key 'java.util.logging.config.file', value 'C:\dev\tools\gae\appengine-java-sdk-1.7.5\appengine-java-sdk-1.7.5\config\sdk\logging.properties' with value 'WEB-INF/logging.properties' from 'C:\dev\projects\org\me\workspace\lottoshop\war\WEB-INF\appengine-web.xml'
Mar 8, 2013 5:07:51 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Mar 8, 2013 5:07:55 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: jetty-6.1.x
Mar 8, 2013 5:07:57 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Started SelectChannelConnector@0.0.0.0:8888
Mar 8, 2013 5:07:57 PM com.google.appengine.tools.development.AbstractServer startup
INFO: Server default is running at http://localhost:8888/
Mar 8, 2013 5:07:57 PM com.google.appengine.tools.development.AbstractServer startup
INFO: The admin console is running at http://localhost:8888/_ah/admin
Mar 8, 2013 5:07:57 PM com.google.appengine.tools.development.DevAppServerImpl start
INFO: Dev App Server is now running
mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.22 (khtml, like gecko) chrome/25.0.1364.152 safari/537.22
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.shared.SearchResponse was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.shared.FieldVerifier was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.client.LottoType was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class com.extjs.gxt.samples.resources.client.TestData was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.server.LottoShopDAOServiceImpl was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.client.resources.Resources was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.client.LottoShopServiceAsync was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class com.extjs.gxt.samples.resources.client.model.Customer was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.shared.SearchRequest was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.client.GameTypes was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class com.extjs.gxt.samples.resources.client.icons.ExampleIcons was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.server.LottoShopServiceImpl was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.client.LottoShopDAOServiceAsync was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.client.Lottoshop was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.client.AppEvents was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.server.EMF was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.client.LottoShopService was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.shared.Constants was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.shared.MultiplePlayersFoundException was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class com.extjs.gxt.samples.resources.client.images.ExampleImages was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.client.LottoShopDAOService was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.client.resources.TestData was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class com.extjs.gxt.samples.resources.client.Resources was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM org.datanucleus.metadata.MetaDataManager loadPersistenceUnit
WARNING: Class co.za.fwc.webapp.lottery.client.icons.ExampleIcons was specified in persistence-unit transactions-optional but not annotated, so ignoring
Mar 8, 2013 5:15:57 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
SEVERE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract co.za.fwc.webapp.lottery.shared.dto.Player co.za.fwc.webapp.lottery.client.LottoShopDAOService.find(java.lang.String) throws co.za.fwc.webapp.lottery.shared.MultiplePlayersFoundException' threw an unexpected exception: java.lang.ExceptionInInitializerError
    at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:389)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:579)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:61)
    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:125)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97)
    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.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:94)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:409)
    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.ExceptionInInitializerError
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)
    at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:64)
    at co.za.fwc.webapp.lottery.server.LottoShopDAOServiceImpl.find(LottoShopDAOServiceImpl.java:42)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
    ... 38 more
Caused by: javax.persistence.PersistenceException: Explicit persistence provider error(s) occurred for "transactions-optional" after trying the following discovered implementations: org.datanucleus.api.jpa.PersistenceProviderImpl from provider: org.datanucleus.api.jpa.PersistenceProviderImpl
    at javax.persistence.Persistence.createPersistenceException(Persistence.java:242)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:184)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:70)
    at co.za.fwc.webapp.lottery.server.EMF.<clinit>(EMF.java:7)
    ... 49 more
Caused by: org.datanucleus.exceptions.NucleusUserException: Errors were encountered when loading the MetaData for the persistence-unit "transactions-optional". See the nested exceptions for details
    at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:979)
    at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialiseNucleusContext(JPAEntityManagerFactory.java:754)
    at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialise(JPAEntityManagerFactory.java:417)
    at org.datanucleus.api.jpa.JPAEntityManagerFactory.<init>(JPAEntityManagerFactory.java:380)
    at org.datanucleus.api.jpa.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:91)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:150)
    ... 51 more
Caused by: org.datanucleus.exceptions.ClassNotResolvedException: Class "com.extjs.gxt.samples.resources.client.model.MailItem" was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
    at org.datanucleus.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:245)
    at org.datanucleus.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:410)
    at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:954)
    ... 56 more

com.google.gwt.user.client.rpc.StatusCodeException: 500 The call failed on the server; see server log for details
    at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:209)
    at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
    at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242)
    at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java.lang.Thread.run(Thread.java:662)

1 个答案:

答案 0 :(得分:5)

我遇到了类似的问题,我使用的是GAE-1.7.7,GWT-2.5.1和Hibernate Validator。一旦我打开验证,客户端验证运行正常,但服务器端持久性搞砸了,显示类似的ClassNotResolvedException异常

在构建EntityManager时扫描类时会出现问题。解决方案是禁用实体的自动扫描,并在构建PersistenceUnit时明确告知要加载哪些类

请修改您的persistence.xml,并在<provider>标记

下方添加以下行
<persistence-unit name="transactions-optional">
    <provider>org.datanucleus.jpa.PersistenceProviderImpl</provider>
    <class>your.package.Entity1</class>
    <class>your.package.Entity2</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>

这应该有用。