Android Studio生成的AppEngine和Endpoints,调用insertObject(insertTTEvent)返回503.奇数,因为其他端点生成的方式相同,工作正常。我可以使用Google控制台手动插入,我可以获取插入的对象,因此端点可用(不是503)。
我的想法是,端点模型有一个List,其他端点模型(有效)没有。或者我可能没有访问当前版本的AppEngine(?)......
此处是来自Google AppEngine信息中心的Endpoint Log的INFO和ERROR备注
2014-02-04 18:50:28.907 /_ah/spi/sic.emo.apptt.TTEventEndpoint.insertTTEvent 500 9ms 0kb TT Google-HTTP-Java-Client/1.15.0-rc (gzip) module=default version=1
75.166.94.168 - - [04/Feb/2014:18:50:28 -0800] "POST /_ah/spi/sic.emo.apptt.TTEventEndpoint.insertTTEvent HTTP/1.1" 500 117 - "TT Google-HTTP-Java-Client/1.15.0-rc (gzip)" "research-petal-332.appspot.com" ms=9 cpu_ms=42 cpm_usd=0.000013 app_engine_release=1.8.9 instance=00c61b117c67fa09551203071b652fff2e29cddd
I 2014-02-04 18:50:28.904
com.google.api.server.spi.SystemService invokeServiceMethod: cause={0}
java.lang.NullPointerException
at org.datanucleus.api.jpa.JPAEntityManager.find(JPAEntityManager.java:318)
at org.datanucleus.api.jpa.JPAEntityManager.find(JPAEntityManager.java:256)
at sic.emo.apptt.TTEventEndpoint.containsTTEvent(TTEventEndpoint.java:157)
at sic.emo.apptt.TTEventEndpoint.insertTTEvent(TTEventEndpoint.java:101)
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:45)
at com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:339)
at com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java:163)
at com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:121)
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 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
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 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.headerComplete(HttpConnection.java:923)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:437)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:188)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441)
at java.lang.Thread.run(Thread.java:724)
E 2014-02-04 18:50:28.905
com.google.api.server.spi.SystemService invokeServiceMethod: null
java.lang.NullPointerException
at org.datanucleus.api.jpa.JPAEntityManager.find(JPAEntityManager.java:318)
at org.datanucleus.api.jpa.JPAEntityManager.find(JPAEntityManager.java:256)
at sic.emo.apptt.TTEventEndpoint.containsTTEvent(TTEventEndpoint.java:157)
at sic.emo.apptt.TTEventEndpoint.insertTTEvent(TTEventEndpoint.java:101)
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:45)
at com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:339)
at com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java:163)
at com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:121)
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 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
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 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.headerComplete(HttpConnection.java:923)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:437)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:188)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441)
at java.lang.Thread.run(Thread.java:724)
答案 0 :(得分:2)
我相信您需要在以下行中设置一个断点:
sic.emo.apptt.TTEventEndpoint.containsTTEvent(TTEventEndpoint.java:157)
最有可能发生的事情是生成的代码试图找到一个实体,因为你正在进行插入而不传入键的值(null,这没关系),代码崩溃了。
我建议你首先通过调试确认是否是这种情况,然后放入if语句首先检查提供ID(密钥)是否为空。只有这样你才能找到findEntity。
答案 1 :(得分:0)
您可能尚未将Endpoint类添加到web.xml文件中。 基于您正在使用的Java servlet API或端点,您需要手动将类定义到web.xml中,如下所示:
<servlet>
<servlet-name>SystemServiceServlet</servlet-name>
<servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>
com.kamalan.backend.registration.UserRegistrationEndpoint,
com.kamalan.backend.RegistrationEndpoint,
com.kamalan.backend.MessagingEndpoint
</param-value>
</init-param>
</servlet>