Carlos Lopez
Carlos Lopez

Reputation: 21

NoClassDefFoundError in GAE with Eclipse

I'm trying to move an app running in Google app-engine from using the BlobstoreService Interface to the newer Cloud Storage without success.

To make things easier, I've started from scratch trying to run one of the Google provided examples (GitHub). I'm using Eclipse 4.6, Google Cloud SDK149.0.0 with the app-engine java version at 1.9.50. The code compiles flawlessly although does not work in the local environment (I expected that). However when deployed in GAE it fails at the runtime with a NoClassDefFoundError:

Uncaught exception from servlet java.lang.NoClassDefFoundError: com/google/api/services/storage/Storage$Builder at com.google.appengine.tools.cloudstorage.oauth.OauthRawGcsService.(OauthRawGcsService.java:175) at com.google.appengine.tools.cloudstorage.oauth.OauthRawGcsServiceFactory.createOauthRawGcsService(OauthRawGcsServiceFactory.java:41) at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createRawGcsService(GcsServiceFactory.java:59) at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService(GcsServiceFactory.java:44) at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService(GcsServiceFactory.java:40) at com.clopez.storage.NewUpload.doPost(NewUpload.java:53)

My code (in fact Google's own code) fails at:

GcsService gcsService = GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());

As I've read in several other Stackoverflow posts, this is usually due to jars not present in my WEB-INF/lib directory so I've included there appengine-api-1.0-sdk-1.9.50.jar, appengine-gcs-client-0.6, com.google.guava_20.0.0, joda-time-2.9.9 and all the jars in the latest Google Java Client API. My WEB-INF directory once deployed is like:

Stackoverflow doesn't allow me to show pictures here, so here's the link

However this keeps failing and I'm astonished. I do not know how to move ahead.

Upvotes: 0

Views: 286

Answers (1)

Carlos Lopez
Carlos Lopez

Reputation: 21

I'm not using Maven so I need to manually include all the needed jars into WEB-INF/lib. Even if I copied all the libraries in the google-api-services-storage-v1-rev104-java-1.22.0.zip package I forgot to include the main one (not under the libs directory in that package). In short dropping google-api-services-storage-v1-rev104-1.22.0.jar into the WEB-INF/lib directory in Eclipse did the job. Thanks a lot.

Upvotes: 2

Related Questions