google app engine - The API package 'file' or call 'Create()' was not found -
i trying use blobstore api, have error:
com.google.api.server.spi.systemservice invokeservicemethod: exception occurred while calling backed method com.google.apphosting.api.apiproxy$callnotfoundexception: api package 'file' or call 'create()' not found. @ java.lang.thread.getstacktrace(thread.java:1589) @ com.google.apphosting.api.apiproxy.makesynccall(apiproxy.java:116) @ com.google.apphosting.api.apiproxy.makesynccall(apiproxy.java:65) @ com.google.appengine.api.files.fileserviceimpl.makesynccall(fileserviceimpl.java:590) @ com.google.appengine.api.files.fileserviceimpl.create(fileserviceimpl.java:512) @ com.google.appengine.api.files.fileserviceimpl.createnewblobfile(fileserviceimpl.java:111) @ com.listecourses.model.listemodelendpoint.insertlistemodel(listemodelendpoint.java:182) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:45) @ com.google.api.server.spi.systemservice.invokeservicemethod(systemservice.java:359) @ com.google.api.server.spi.systemserviceservlet.execute(systemserviceservlet.java:113) @ com.google.api.server.spi.systemserviceservlet.dopost(systemserviceservlet.java:71) @ javax.servlet.http.httpservlet.service(httpservlet.java:637) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.mortbay.jetty.servlet.servletholder.handle(servletholder.java:511) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1166) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ org.mortbay.jetty.servlet.servlethandler.handle(servlethandler.java:388) @ org.mortbay.jetty.security.securityhandler.handle(securityhandler.java:216) @ org.mortbay.jetty.servlet.sessionhandler.handle(sessionhandler.java:182) @ org.mortbay.jetty.handler.contexthandler.handle(contexthandler.java:765) @ org.mortbay.jetty.webapp.webappcontext.handle(webappcontext.java:418) @ org.mortbay.jetty.handler.handlerwrapper.handle(handlerwrapper.java:152) @ org.mortbay.jetty.server.handle(server.java:326) @ org.mortbay.jetty.httpconnection.handlerequest(httpconnection.java:542) @ org.mortbay.jetty.httpconnection$requesthandler.headercomplete(httpconnection.java:923) @ org.mortbay.jetty.httpconnection.handle(httpconnection.java:404) @ com.google.tracing.tracecontext$tracecontextrunnable.runincontext(tracecontext.java:437) @ com.google.tracing.tracecontext$tracecontextrunnable$1.run(tracecontext.java:444) @ com.google.tracing.currentcontext.runincontext(currentcontext.java:230) @ com.google.tracing.tracecontext$abstracttracecontextcallback.runininheritedcontextnounref(tracecontext.java:308) @ com.google.tracing.tracecontext$abstracttracecontextcallback.runininheritedcontext(tracecontext.java:300) @ com.google.tracing.tracecontext$tracecontextrunnable.run(tracecontext.java:441) @ java.lang.thread.run(thread.java:745)
i using code:
@apimethod(name = "insertlistemodel", httpmethod = "post") public listemodel insertlistemodel(listemodel listemodel) { entitymanager mgr = getentitymanager(); try { if (containslistemodel(listemodel)) { throw new entityexistsexception("object exists"); } fileservice fileservice = fileservicefactory.getfileservice(); if(listemodel.getimage()!=null && !listemodel.getimage().equals("")) { byte[] data = listemodel.getimage(); string mimetype = "image/png"; // save data google app engine blobstore listemodel.setimage(null); mgr.persist(listemodel); appenginefile file; file = fileservice.createnewblobfile(mimetype,"lm_"+listemodel.getid()); filewritechannel writechannel = fileservice.openwritechannel(file, true); writechannel.write(java.nio.bytebuffer.wrap(data)); writechannel.closefinally(); // blobkey data in google app engine blobstore blobkey blobkey = fileservice.getblobkey(file); // blobkey can example serving url images // uploadoptions uploadoptions = uploadoptions.builder // .withgooglestoragebucketname("photobucket11"); // image serving url (in https:// format) string imageurl = imagesservicefactory.getimagesservice().getservingurl(servingurloptions.builder.withblobkey(blobkey).secureurl(true)); // imagesservice imagesservice = imagesservicefactory // .getimagesservice(); // servingurloptions servingoptions = servingurloptions.builder // .withblobkey(blobkey); // string imageurl = imagesservice.getservingurl(servingoptions); if(listemodel.getidblobkey()!=null) { blobkey blobkeytmp= new blobkey(listemodel.getidblobkey()); final appenginefile f = fileservice.getblobfile(blobkeytmp); if(f.isreadable()) { if(f.hasfinalizedname()) { fileservice.delete(f); // problematic line } } } listemodel.setavatar(imageurl); listemodel.setidblobkey(blobkey.getkeystring()); } mgr.persist(listemodel); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } { mgr.close(); } return listemodel; }
can me?
it appears files api deprecated in 2013, , disabled year. see: https://cloud.google.com/appengine/docs/deprecations/files_api
Comments
Post a Comment