2

Anyone ever have this happen? It's the opposite of working in dev and failing in deployed.

My web app successfully uses ImagesServiceImpl.getServingUrl() on Deployment but not in dev server.

I looked here to see if there was something missing in my dev environment configuration that the deployed environment has: https://developers.google.com/appengine/docs/java/config/appconfig#About_appengine_web_xml

Also looked here: https://developers.google.com/appengine/docs/java/images/overview#Development_Server.

Here's what happens in my console when I run the code giving me trouble:

Oct 13, 2012 8:40:33 AM com.google.appengine.api.images.dev.LocalImagesService init
WARNING: No image reader found for format "ico". An ImageIO plugin must be installed to use this format with the DevAppServer.
Oct 13, 2012 8:40:33 AM com.google.appengine.api.images.dev.LocalImagesService init
WARNING: No image reader found for format "tif". An ImageIO plugin must be installed to use this format with the DevAppServer.
Oct 13, 2012 8:40:33 AM com.google.appengine.api.images.dev.LocalImagesService init
WARNING: No image reader found for format "webp". An ImageIO plugin must be installed to use this format with the DevAppServer.
Oct 13, 2012 8:40:33 AM com.google.appengine.api.images.dev.LocalImagesService init
WARNING: No image writer found for format "webp". An ImageIO plugin must be installed to use this format with the DevAppServer.
Oct 13, 2012 8:40:34 AM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: /upload
java.lang.IllegalArgumentException: Failed to read image
    at com.google.appengine.api.images.ImagesServiceImpl.getServingUrl(ImagesServiceImpl.java:282)

Although I don't have a webp, ico, and tif decoder plugin, that shouldn't be a problem since I'm ONLY dealing with jpeg images.

Here's a portion of the code:

    FileService fileService = FileServiceFactory.getFileService();
    AppEngineFile newBlob = fileService.createNewBlobFile("image/jpeg");

    // Create a new Blob file with mime-type "image/jpeg"

    byte[] buffer = new byte[4096]; // 4MB
    boolean lock = true;
    FileWriteChannel writeChannel = fileService.openWriteChannel(newBlob, lock);
    // increase the buffer size as you are reading from the 
    // input stream. Read the input stream into buffer
    for (int n; (n = stream.read(buffer)) != -1; ){ 
        writeChannel.write(ByteBuffer.wrap(buffer));
    } 
        stream.close();
        writeChannel.closeFinally();


BlobKey blobKey = fileService.getBlobKey(newBlob);
ImagesService imagesService = ImagesServiceFactory.getImagesService();

As you may tell, I'm using lower level code for receiving an upload from a user (instead of using getUploadUrl.

One difference between my datastore on deployment and my datastore in dev is that I see a BlobFileIndex entity kind in the datastore for my dev.

Thank you for any input!

1 Answers1

1

Froms the docs: The Java development server uses the ImageIO framework to simulate the Image service. The "I'm Feeling Lucky" photo enhancement feature is not supported. The WEBP image format is only supported if a suitable decoder plugin has been installed. The Java VP8 decoder plugin can be used, for example.

Have you installed the latest 1.7.2. There were some problems fixed with getServingUrl in the development server.

voscausa
  • 11,253
  • 2
  • 39
  • 67
  • Yep, I'm using 1.7.2. I never use webp images (only jpeg) so I don't think it could be that. How would you go about installing a decoder plugin, though? – user1544470 Oct 13 '12 at 13:53
  • I do not know how this works in Java. But I had this same kind of problem in Python and found out that I had to install an image lib (PIP) and the latest dev server. Because you only use jpeg, you can ignore the log warnings. So your problem is with the illegal argument. I found (getServingUrl illegalargumentexception): http://stackoverflow.com/questions/6422192/create-image-serving-url-for-new-blob-file – voscausa Oct 13 '12 at 14:07