我已经使用Google端点创建了一个方法并将其公开.我想要的只是从Google DataStore保存和检索数据.
当我尝试使用API Explorer进行测试时,出现以下错误 –
java.lang.NoSuchMethodError
我已附上以下代码
@ApiMethod (name ="mTest") public void mTest(@com.google.api.server.spi.config.Named("UName") String UName) throws IOException { DatastoreService datastoreService; datastoreService = DatastoreServiceFactory.getDatastoreService(); Transaction tx=datastoreService.beginTransaction(); try { Key userKey = KeyFactory.createKey("USERS_PK",UName); Entity userEntity=new Entity("M_USERS",userKey); userEntity.setProperty("TestColumn","TestColumnValue"); datastoreService.put(userEntity); tx.commit(); }finally { if (tx.isActive()){ tx.rollback(); } } }
在datastoreService.put(userEntity)上遇到错误;
请在下面找到堆栈跟踪:
Jun 29,2014 5:12:20 PM com.google.api.server.spi.SystemService invokeServiceMethod INFO: cause={0} java.lang.NoSuchMethodError: com.google.appengine.api.datastore.Key.getAppIdNamespace()Lcom/google/appengine/api/datastore/AppIdNamespace; at com.google.appengine.api.datastore.KeyTranslator.convertToPb(KeyTranslator.java:49) at com.google.appengine.api.datastore.EntityTranslator.convertToPb(EntityTranslator.java:50) at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl$4.toPb(AsyncDatastoreServiceImpl.java:203) at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl$4.toPb(AsyncDatastoreServiceImpl.java:180) at com.google.appengine.api.datastore.Batcher$BatchIterator.<init>(Batcher.java:177) at com.google.appengine.api.datastore.Batcher$2.<init>(Batcher.java:312) at com.google.appengine.api.datastore.Batcher.getBatches(Batcher.java:312) at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl.doBatchPut(AsyncDatastoreServiceImpl.java:536) at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl.put(AsyncDatastoreServiceImpl.java:490) at com.google.appengine.api.datastore.DatastoreServiceImpl$2.runInternal(DatastoreServiceImpl.java:95) at com.google.appengine.api.datastore.DatastoreServiceImpl$2.runInternal(DatastoreServiceImpl.java:92) at com.google.appengine.api.datastore.TransactionRunner.runInTransaction(TransactionRunner.java:29) at com.google.appengine.api.datastore.DatastoreServiceImpl.put(DatastoreServiceImpl.java:92) at com.google.appengine.api.datastore.DatastoreServiceImpl.put(DatastoreServiceImpl.java:81) at GetMedSoonAppEngineProject.GMS_UserRegistrationEndpoint.mTest(GMS_UserRegistrationEndpoint.java:125) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115) at com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:359) at com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java:124) at com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:82) 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:127) 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:63) 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.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366) at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349) at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116) 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:98) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:491) 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) Jun 29,2014 5:12:20 PM com.google.api.server.spi.SystemService invokeServiceMethod SEVERE: com.google.appengine.api.datastore.Key.getAppIdNamespace()Lcom/google/appengine/api/datastore/AppIdNamespace; java.lang.NoSuchMethodError: com.google.appengine.api.datastore.Key.getAppIdNamespace()Lcom/google/appengine/api/datastore/AppIdNamespace; at com.google.appengine.api.datastore.KeyTranslator.convertToPb(KeyTranslator.java:49) at com.google.appengine.api.datastore.EntityTranslator.convertToPb(EntityTranslator.java:50) at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl$4.toPb(AsyncDatastoreServiceImpl.java:203) at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl$4.toPb(AsyncDatastoreServiceImpl.java:180) at com.google.appengine.api.datastore.Batcher$BatchIterator.<init>(Batcher.java:177) at com.google.appengine.api.datastore.Batcher$2.<init>(Batcher.java:312) at com.google.appengine.api.datastore.Batcher.getBatches(Batcher.java:312) at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl.doBatchPut(AsyncDatastoreServiceImpl.java:536) at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl.put(AsyncDatastoreServiceImpl.java:490) at com.google.appengine.api.datastore.DatastoreServiceImpl$2.runInternal(DatastoreServiceImpl.java:95) at com.google.appengine.api.datastore.DatastoreServiceImpl$2.runInternal(DatastoreServiceImpl.java:92) at com.google.appengine.api.datastore.TransactionRunner.runInTransaction(TransactionRunner.java:29) at com.google.appengine.api.datastore.DatastoreServiceImpl.put(DatastoreServiceImpl.java:92) at com.google.appengine.api.datastore.DatastoreServiceImpl.put(DatastoreServiceImpl.java:81) at GetMedSoonAppEngineProject.GMS_UserRegistrationEndpoint.mTest(GMS_UserRegistrationEndpoint.java:125) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115) at com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:359) at com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java:124) at com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:82) 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:127) 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:63) 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.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366) at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349) at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116) 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:98) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:491) 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)
任何帮助表示赞赏!我坚持了一个月,我无法找到解决方案.
IDE:Android Studio 0.61
操作系统:Windows 8