我有一個Appengine連接的Andorid項目,以啓用服務器和Android設備之間的RPC調用。當我在GWT客戶端上進行調用時,一切正常,但是當我從Android應用程序進行調用時,服務器會拋出此空指針異常。我正在使用Requestfactory進行RPC調用。 GAE版本1.5.2Android Appengine服務器上的RPC Nullponter
[ERROR] Unexpected error
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
at com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:225)
at com.google.web.bindery.requestfactory.server.ServiceLayerCache.resolveRequestFactory(ServiceLayerCache.java:198)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:203)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:127)
at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.doPost(RequestFactoryServlet.java:133)
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.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: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.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:212)
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)
問題是堆棧跟蹤不提供任何有關我的代碼中的一些問題的信息。
我想要做的是從Android客戶端發送一個異常到AppEngine服務器。所以這是Android端代碼。
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... arg0) {
MyRequestFactory factory = (MyRequestFactory) Util
.getRequestFactory(context,
MyRequestFactory.class);
ExceptionRequest request = factory.exceptionRequest();
ExceptionProxy ep = request.create(ExceptionProxy.class);
ep.setClassName(aThrowable.getClass().getSimpleName());
ep.setRevision(1);
ep.setVersionName("2.1.2");
ep.setStack("");
request.updateException(ep).fire();
return null;
}
}.execute();
而拋出這個異常(內部服務器錯誤)
09-05 22:29:36.104: ERROR/AndroidRuntime(602): Caused by: java.lang.RuntimeException: Internal Server Error
09-05 22:29:36.104: ERROR/AndroidRuntime(602): at com.google.web.bindery.requestfactory.shared.Receiver.onFailure(Receiver.java:44)
09-05 22:29:36.104: ERROR/AndroidRuntime(602): at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.fail(AbstractRequestContext.java:677)
09-05 22:29:36.104: ERROR/AndroidRuntime(602): ... 13 more
Web客戶端上做RPC完美的作品,但在Android上一個我無法得到它的工作。
由於您還沒有告訴我們關於您的應用程序的任何信息,或者您是如何稱呼它的,所以我沒有看到任何人都可能找出問題所在。 –
用更多的信息更新了這個問題 –