我正在使用java开发谷歌应用程序,但我收到此错误:java.io.FileOutputStream is a restricted class
当我尝试上传比其他人更大的csv文件时。
当我上传5-6kb的文件时,一切正常,我收到30kb文件的错误。
我当然导入了所有的库并阅读了一些教程/问题,但我不知道要解决这个问题。
代码:
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setFileSizeMax(50000);
upload.setSizeMax(50000);
List<FileItem> items = upload.parseRequest(req); // <-- error line (48)
java.lang.NoClassDefFoundError: java.io.FileOutputStream is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:50)
at org.apache.commons.io.output.DeferredFileOutputStream.thresholdReached(DeferredFileOutputStream.java:178)
at org.apache.commons.io.output.ThresholdingOutputStream.checkThreshold(ThresholdingOutputStream.java:224)
at org.apache.commons.io.output.ThresholdingOutputStream.write(ThresholdingOutputStream.java:128)
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:108)
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:70)
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:347)
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:115)
at it.injenia.gestionefirme.servlet.uploadkind.UploadKind.doPost(UploadKind.java:48)
答案 0 :(得分:0)
不允许Google App Engine应用程序写入文件系统。
上传适用于较小的文件,因为它们保存在内存中。要将较大的文件存储在内存中,可以将默认大小阈值增加到10KB。