views:

144

answers:

2

I am trying to upload a file in GAE using the Blobstore API. I am getting the following exception when running the GAE server locally (dev mode):

WARNING: /_ah/upload/ag10cmlwc2NoZWR1bGVychsLEhVfX0Jsb2JVcGxvYWRTZXNzaW9uX18YFQw
java.lang.IllegalStateException: Must call one of set*BlobStorage() first.
 at com.google.appengine.api.blobstore.dev.BlobStorageFactory.getBlobStorage(BlobStorageFactory.java:24)
 at com.google.appengine.api.blobstore.dev.UploadBlobServlet.init(UploadBlobServlet.java:88)
 at javax.servlet.GenericServlet.init(GenericServlet.java:215)
 at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)
 at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)

I am running GAE 1.3.5 but have tried all versions since GAE 1.3.0 (first version with the Blobstore). I am using the GAE maven plugin: http://code.google.com/p/maven-gae-plugin/

My form is written in GWT 2.0.4. Currently, the form is just a file input field with a submit.

I receive the above exception after submitting the form. I am able to successfully retrieve an upload URL from the Blobstore Service.

Everything works fine on GAE. I have verified that nothing is entered into the blobstore in my local dev env (via the dev admin console). I am uploading a CSV that is ~1Kb but have tried other file types/sizes as well without success (same files work on GAE prod).

A: 

I ran accross this; it was frustrating.

Any how, the way I got around it by shutting down and restarting several times.

It comes and goes; so I suggest to closing and reopening eclips and you will be OK

Abu al-Sous
I have tried restarting numerous times. I am not using eclipse; I am using the maven gae plugin. Upgrading to the latest version and downgrading to various versions does not help either.
Brad
+1  A: 

The issue was caused by having the stubs and testing jars included on the classpath when running the dev app server. If you are using maven, simply change the scope of the dependency:

<dependency>
    <groupId>com.google.appengine</groupId>
    <artifactId>appengine-api-stubs</artifactId>
    <version>${gae.version}</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>com.google.appengine</groupId>
    <artifactId>appengine-testing</artifactId>
    <version>${gae.version}</version>
    <scope>test</scope>
</dependency>

If you are not using maven, make sure these jars are not in your WEB-INF/lib or classpath.

Brad