Archit
Archit

Reputation: 207

GAE : java.lang.NoClassDefFoundError: com/google/appengine/api/blobstore/BlobstoreServiceFactory

Kindly help me with this. I am using blob store for saving images and it is working perfectly fine on my local environment. But when I deploy the same code the cloud it is throwing me the exception : java.lang.NoClassDefFoundError: com/google/appengine/api/blobstore/BlobstoreServiceFactory

I am using GAE 1.8.4

Upvotes: 2

Views: 470

Answers (2)

A. Masson
A. Masson

Reputation: 2477

In my case the required jar was inside the WEB-INF/lib folder but the error was still occuring... I found that this error was occuring because Jetty 9 was not done yet with class loading startup process while one of my initialization class was requiring BlobstoreService:

public class InitializeAppContextListener implements ServletContextListener {

    private BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();

So I had to postpone instance variable initialization once context is fully loaded as follow:

public class InitializeAppContextListener implements ServletContextListener {
    private BlobstoreService blobstoreService;

    public void contextInitialized(ServletContextEvent event) {
        blobstoreService = BlobstoreServiceFactory.getBlobstoreService();

Then the webapp was able to start normally again. This new behavior appeared after we had upgraded from servlet-api 2.5 to 3.1 with JDK 1.8...

Upvotes: 0

Andrei Volgin
Andrei Volgin

Reputation: 41099

Most likely, appengine-api.jar is missing from your war/WEB-INF/lib/ folder.

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.

Upvotes: 1

Related Questions