0

I have an app that is successfully uploading content to a server on Google´s App Engine. What I wanna do now, is retrieve that content using a DataStore constructed like this:

 DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();

Whenever I call that line, I get the following error:

09-05 11:21:37.922: E/AndroidRuntime(27138): FATAL EXCEPTION: AsyncTask #2
Caused by: java.lang.NoClassDefFoundError: 
com.google.appengine.api.datastore.DatastoreServiceFactory

I´m unsure at the moment if the problem lies on the application itself, or on the AppEngine. I have already tried to add some suggested JARs to my buildpath, for example appengine-agent.jar and appengineagentimpl.jar without success.

I would deeply appreciate any inputs on this. Thanks!

1
  • Are you using eclipse or Android Studio? Commented Sep 5, 2014 at 14:42

1 Answer 1

2

Note that DatastoreServiceFactory is only available on the server-side. If that's the case, then you need to add required jars to your war/WEB-INF/lib/ folder. It's not enough to have them on your buildpath.

If you use Eclipse, click on the Problems tab. You may see a warning saying that this jar is not available on a server. Right click on this warning, select QuickFix, select "Copy..." option. Or copy this jar to this directory manually.

Sign up to request clarification or add additional context in comments.

6 Comments

Hey, thank you for your response. I don't see that warning and here are the JARs I have on my war/WEB-INF/lib folder: appengine-agent, appengine-impl, appengine-api-1.0-sdk-1.9.10, appengine-api-labs, appengine-api-stubs, appengine-api, appengine-datastore-filter, appengine-endpoinds-deps, appengine-endpoints, appengine-jsr107cache-1.9.10, appengine-remote, asm-4.0, datanucleus-api-jdo-3.1.3, datanucleus-api-jpa-3.1.3, datanucleus-appengine-2.1.2, datanucleus-core-3.1.3, gcm-server, geronimo-jpa, jod-api, json_simple, jsr17cache, jta-1.1. Pretty extensive list. Do you see any missing?
I just added ALL the jar files inside Google's AppEngine SDK to the war/WEB-INF/lib folder, redeployed to App Engine and I got the same error. Really frustrating.
Are you sure you have no references to this class in your client (Android) code?
Well the code that I posted in the OP ( DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();) is actually called in an AsyncTask to retrieve the entites from the server. Is this a problem?
App Engine SDK can only be used on the server-side. There should be no references to SDK classes in the client code. Look at using endpoints in Android: developers.google.com/appengine/docs/java/endpoints/…
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.