Google App Engine - ImagesService.getServingUrl() fails to read image

淺唱寂寞╮ 提交于 2020-01-06 08:12:09

问题


I'm receiving an image file through a HTTP request and storing it in the Blobstore. My code is along the lines of that found here: [https://developers.google.com/appengine/docs/java/blobstore/overview#Writing_Files_to_the_Blobstore][1].

When calling the function ImagesService.getServingUrl() on the blobkey for the image I had stored I get the message below:

HTTP ERROR 500

Problem accessing /upload. Reason:

    Failed to read image
Caused by:

java.lang.IllegalArgumentException: Failed to read image
    at com.google.appengine.api.images.ImagesServiceImpl.getServingUrl(ImagesServiceImpl.java:282)

After hours of googling, trying to find a solution, I think that the problem is that the function closeFinally() is faulty. I think this because after closing the new blob image that I make, the FileStats object associated with the blob returns false for the hasFinalizedName(). Yet the blob returns true for isClosed() and isFinalized(). Also, its full path is something like this:

/blobstore/writable:xFSAF_493dsfAfw489vFa...

If it is closed it shouldn't be writable, I think.

So my questions are: Does anyone have a solution to the getServingUrl not working? Does anyone have a workaround getServingUrl? I want to have pictures to serve to users and I want these pictures to exist as static files. getServingUrl with blobstore seems to be the best choice for me. I don't want to use Google Cloud Storage because for every Blobstore vs Google Cloud Storage question I saw, Blobstore won it seemed.

来源:https://stackoverflow.com/questions/12868646/google-app-engine-imagesservice-getservingurl-fails-to-read-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!