java - FinalizationException - AppEngine Java Blobstore API

标签 java google-app-engine blob blobstore

我尝试使用实验Writing Files to Blobstore即使使用演示代码,我在尝试读取文件时仍不断收到 FinalizationException。

我使用的代码如下:

FileService fileService = FileServiceFactory.getFileService();

AppEngineFile file = null;
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();
String path = file.getFullPath();

file = new AppEngineFile(path);

writeChannel = fileService.openWriteChannel(file, true);

writeChannel.write(ByteBuffer.wrap("And miles to go before I sleep.".getBytes()));

writeChannel.closeFinally();

我在另一个请求中获得 FinalizationException 的读取代码如下:

    FileService fileService = FileServiceFactory.getFileService();

    String path = //get the path code       
    AppEngineFile file = new AppEngineFile(path);

    FileReadChannel readChannel;
    try {
        readChannel = fileService.openReadChannel(file, false);
    } catch (FileNotFoundException e) { }

我在 openReadChannel 行收到 Finalization Exception

如有任何帮助,我们将不胜感激。

最佳答案

此示例在开发服务器上运行良好。

关于java - FinalizationException - AppEngine Java Blobstore API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8110207/

相关文章:

java - 动态加载模板文件到 Rythm? (无需目录设置)

java - Easymock 使用日期期望

App Engine Flexi 上的 Wordpress - (gcloud.app.deploy) 错误响应 : [13] An internal error occurred during deployment

java - Google Application Engine 中的 System.setProperty (java) 相当于什么(又是 java)

node.js - Google App Engine 中的文件在哪里下载?

git - 在 GitHub URL 的 : what is the difference between a tree and a blob?

java - Action 监听器不起作用

java - 实例化用户定义类型集合的约定是什么?

MYSQL TINYBLOB 与 LONGBLOB

javascript - Canvas.toBlob() 给出空白 blob 对象的 url?