Android to Appengine RPC Nullponter on server

Tagged:
Freelance Jobs

I have a Appengine connected Andorid project, to enable RPC calls between the server and the Android device. When I'm doing calls on the GWT client everything works perfectly, but when I'm doing calls from the Android app the server throws this nullpointer exception. I'm making RPC calls with a Requestfactory. GAE version 1.5.2

[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)

The problem is that the stack trace doesn't provide any information about some issues in my code.

What I want to do is to send an Exception from the Android Client to the AppEngine Server. So that's the android side code.

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();

And that throws this exception (Internal Server Error)

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

Doing RPC on the web client works perfectly but on the Android one I can't get it to work.


Dominic BartlH
2011-08-31 18:27:26 Scores:1
Since you haven't told us anything at all about your app or how you're calling it, I don't see how anyone could possibly figure out what's wrong.
Nick JohnsonH
2011-09-05 05:08:47 Scores:0
updated the question with more information
Dominic BartlH
2011-09-05 20:46:25 Scores:0

3 answers

Answer 1
Scores:1

I encountered this and accidentally (I think) found an answer to it. Create a new AppEngine app (not a new App Engine Connected Android project, but literally going to appengine.google.com), and try testing it on your newly created app. I think they made some changes to AppEngine, and you need a new one to properly use App Engine Connected Android Project.

Best of luck!

spierce7 H
2011-09-15 07:48:02
Answer 2
Scores:0

It's because of the version of the GAE. Update it to 1.6.1.

Wenbo H
2012-01-14 22:03:18
The question is kinda old and I already fixed it. I just forgot to write an answer here. Yes I made an update and it worked since then.
Dominic Bartl H
2012-01-14 23:32:59 Scores:0
Answer 3
Scores:0

In order to have an android app working with google app engine, you must create the App Engine connected Android project in Eclipse with GWT 2.3.0 configurated by default: Windows -> Preferences -> Google -> Web Toolkit (and not 2.4.0rc1)

If you try change the GWT version from 2.4.0rc1 to 2.3.0 after having created a project, you will always have this error with the android app (web app will work)

Riego H
2012-06-16 21:39:39
Share |
View original post at stackoverflow.com

Related topics

How would you implement a secure static login credentials system in Java?

We recently had a security audit and it exposed several weaknesses in the systems that are in place here. One of the tasks that resulted from it is that we need to update our partner credentials system make it more secure. The "old" way of doing things was ...

how can i get value fron the URL in python appengine?

if i have this URL in from python code on appengine http://localhost:8080/blog/view/2f1cab5844fb432b8426ae666c4ac493 how can i get the value of the key : 2f1cab5844fb432b8426ae666c4ac493 ...

Upload to Appengine Blobstore in Android

I'm working on a simple multimedia messaging app for Android, and I was trying to use Google AppEngine's BlobStore as my cloud storage for the various image, video, and audio files that will be transferred. However, all of the examples and such that I've seen for uploading to blobstore ...

Appengine authentication on Android

I have a Python App Engine application where a user can log in using foursquare, then they must log in using Hunch. This all works fine but now I am trying to allow the user to authenticate on the android device. I don't want the user to have to log ...

Connection between Android and AppEngine! Suggestions

I'm about to start a new project where an android client and a gwt client has to communicate with an appengine server. My first thougts were GWT to Appengine = RPC Android to Appengine = RPC Appengine to Android = C2DM My question is if you have better ideas to solve a communication. Basically what ...

Android/Appengine "anonymous" access

I'm planning to develop an Android application with an app-engine backend. However I would like to refrain from using authentication (either with Google accounts or Open ID). Since the data will be sent only from my app and not any other client, and will be over SSL connection, I consider the ...

How to get image from AppEngine Server into Android activity

I'm trying to fetch an image from the AppEngine server in development mode, using this code from here: HttpGet httpRequest = new HttpGet(URI.create(url) ); HttpClient httpclient = new DefaultHttpClient(); HttpResponse resp = (HttpResponse) httpclient.execute(httpRequest); HttpEntity entity = resp.getEntity(); BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity); InputStream instream = bufHttpEntity.getContent(); bmp = BitmapFactory.decodeStream(instream); When executing the 3rd line (httpclient.execute(..)) I ...

Login to appengine from android client

I am attempting to login to appengine to app engine and access the User service API in app engine. Basically I want to be able to see who is logged in to my servlets. I am using the authentication flow of getting authtoken from android and then gettting ...

Getting an auth token for appengine in ICS

I am having a problem retrieving an authentication token for an appengine application in Android. I am following the docs, in that I get the users google account, and attempt to get the auth token from the account manager which works fine. However I get an intent back from the ...

Sharing data between AppEngine and Android

I want to use AppEngine with Android based on C2DM, but I have strange question. Is there any possibility or metodology to share logic and maybe data of application between server and client? If I want to play chess online it is ok, but what if my game offers also ...