Google app engine 迁移到HRD后,写入google数据存储的代码中断
下面的代码在主从复制数据存储上运行得非常好,在我们今天迁移到HRD之后就崩溃了。我看到的例外是Google app engine 迁移到HRD后,写入google数据存储的代码中断,google-app-engine,Google App Engine,下面的代码在主从复制数据存储上运行得非常好,在我们今天迁移到HRD之后就崩溃了。我看到的例外是 E 2012-09-19 21:59:13.603 vik.sakshum.sakshumweb.server.common.CommonServiceCode writeToGoogleStore: Exception in finally of execute of writeToGoogleStore E 2012-09-19 21:59:13.603 vik.sakshum.sakshumwe
E 2012-09-19 21:59:13.603
vik.sakshum.sakshumweb.server.common.CommonServiceCode writeToGoogleStore: Exception in finally of execute of writeToGoogleStore
E 2012-09-19 21:59:13.603
vik.sakshum.sakshumweb.server.common.CommonServiceCode writeToGoogleStore: Exception class is :java.io.IOException
E 2012-09-19 21:59:13.603
vik.sakshum.sakshumweb.server.common.CommonServiceCode writeToGoogleStore: Exception is :null
代码
转到人力资源部也意味着你有了一个新的应用程序名和服务帐户名。您可能需要将新帐户添加到该存储桶的ACL中。oh is it。。我甚至不记得我在哪里添加了任何特定于应用程序id的详细信息。
try {
log.info("Starting google storage");
// Get the file service
FileService fileService = FileServiceFactory.getFileService();
GSFileOptionsBuilder optionsBuilder = new GSFileOptionsBuilder()
.setBucket(bucketName).setKey(key).setAcl("public-read")
.setMimeType("text/html");
// Create your object
AppEngineFile writableFile = fileService
.createNewGSFile(optionsBuilder.build());
// Open a channel for writing
boolean lockForWrite = true;
FileWriteChannel writeChannel = fileService.openWriteChannel(
writableFile, lockForWrite);
PrintWriter out = new PrintWriter(Channels.newWriter(writeChannel,
"UTF8"));
out.println(emailMsgTxt);
out.close();
writeChannel.closeFinally();
} catch (Exception e) {
e.printStackTrace();
log.severe("Exception in finally of execute of writeToGoogleStore");
log.severe("Exception class is :" + e.getClass().getName());
log.severe("Exception is :" + e.getMessage());
return "failed";
}