Failure to open write channel after upgrading App Engine Java SDK -
i'm trying upgrade version of app engine sdk using our play! web application 1.6.0 1.7.6.
after upgrade we're no longer able write files blobstore of local development server. use following code write file:
image img = imagesservicefactory.makeimage(uploadeddata); fileservice fileservice = fileservicefactory.getfileservice(); appenginefile file = fileservice.createnewblobfile("image/png", "__initial_data/" + vf.getname()); filewritechannel writechannel = fileservice.openwritechannel(file, true); outputstream output = channels.newoutputstream(writechannel);
the call fileservice.openwritechannel
fails following stack trace:
caused by: java.lang.nullpointerexception @ com.google.appengine.tools.development.requestendlistenerhelper.register(requestendlistenerhelper.java:39) @ com.google.appengine.api.files.dev.localfileservice.open(localfileservice.java:247) @ com.google.appengine.tools.development.apiproxylocalimpl$asyncapicall.callinternal(apiproxylocalimpl.java:527) @ com.google.appengine.tools.development.apiproxylocalimpl$asyncapicall.call(apiproxylocalimpl.java:481) @ com.google.appengine.tools.development.apiproxylocalimpl$asyncapicall.call(apiproxylocalimpl.java:458) @ java.util.concurrent.executors$privilegedcallable$1.run(executors.java:461) @ java.security.accesscontroller.doprivileged(native method) @ java.util.concurrent.executors$privilegedcallable.call(executors.java:458) @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:303) @ java.util.concurrent.futuretask.run(futuretask.java:138) @ java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:895) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:918) @ java.lang.thread.run(thread.java:680)
although sdk of app engine open source, cannot find source files these development-specific classes find out going on internally.
does know if implementation details writing objects blobstore has changed since version 1.6.0?
it turns out play! specific issue. play-gae module implements it's own localserverenvironment app engine, called playdevenvironment
. contains method list of attributes. between version 1.6.0 , 1.7.7 of app engine change made needed additional attributes returned. solved changing class follows:
public class playdevenvironment implements environment, localserverenvironment { ... @override public map<string, object> getattributes() { hashmap<string, object> hashmap = new hashmap<string, object>(); hashmap.put(localenvironment.request_end_listeners, new arraylist<requestendlistener>()); return hashmap; } }
Comments
Post a Comment