I read the doc. you pointed out as such: when "out.close()" was called, the "writeChannel" was not closed; when "readChannel.close()" was called, the "reader" itself was not closed. So, looks like you only need to do one or the other. It may have to do with how closing is implemented on the channels.
So remove "out.close()", and see if the exception would go away. Wen On Aug 18, 7:05 am, André Salvati <andre.f.salv...@gmail.com> wrote: > Hi, > > Maybe I've misunderstood docs, but I thought it was possible an > external application to integrate with App Engine by creating a file > in Blobstore. Am I doing something wrong?? Any way to accomplish > this?? > > http://code.google.com/appengine/docs/java/blobstore/overview.html#Wr... > > Thanks. > > Code: > > public class RemoteAPI { > > public static void main(String[] args) throws IOException { > > String username = "x...@gmail.com"; > String password = "xxxxx"; > > RemoteApiOptions options = new RemoteApiOptions() > .server("primepartes.appspot.com", 443) > .credentials(username, password); > RemoteApiInstaller installer = new RemoteApiInstaller(); > installer.install(options); > > FileService fileService = FileServiceFactory.getFileService(); > BlobstoreService blobstoreService = > BlobstoreServiceFactory.getBlobstoreService(); > > AppEngineFile file = fileService.createNewBlobFile("text/ > plain"); > > FileWriteChannel writeChannel = > fileService.openWriteChannel(file, true); > > PrintWriter out = new > PrintWriter(Channels.newWriter(writeChannel, "UTF8")); > out.println("The woods are lovely dark and deep."); > out.println("But I have promises to keep."); > > out.close(); > writeChannel.closeFinally(); // This line throwns the excepion > bellow > > .............. > > java.lang.IllegalStateException: The current request does not hold the > exclusive lock. > at > com.google.appengine.api.files.FileServiceImpl.close(FileServiceImpl.java: > 315) > at > com.google.appengine.api.files.FileWriteChannelImpl.closeFinally(FileWriteC > hannelImpl.java: > 78) > at br.com.teste.RemoteAPI.main(RemoteAPI.java:82) -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.