GAE java.lang.IllegalStateException: Must call one of set*BlobStorage() first

前端 未结 5 517
情歌与酒
情歌与酒 2021-01-14 18:41

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: /_         


        
相关标签:
5条回答
  • 2021-01-14 19:12

    When call your page that generates html (using servlet, jsp, etc.) and calls blobstoreService.createUploadUrl("/upload"); you can't re-use this page multiple times.

    Reload this page in a browser every time you want to upload the file.

    0 讨论(0)
  • 2021-01-14 19:15

    I am not using Maven, just Eclipse and the GAE plugins. I also didn't see any test.jar files in my classpath. I just deleted the Run Configuration in Eclipse and restarted and it worked. No idea what went wrong, but this fixed the issue for me while running in dev/local mode.

    0 讨论(0)
  • 2021-01-14 19:19
    $ mvn clean gae:run -DskipTest 
    

    works for me

    0 讨论(0)
  • 2021-01-14 19:21

    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.

    0 讨论(0)
  • 2021-01-14 19:29

    If not using maven but Eclipse with plugin:

    REMOVE RUN/DEBUG CONFIGURATION. To create new, simply right click on project and select run/debug As > Web Application

    0 讨论(0)
提交回复
热议问题