谷歌应用程序中的rmi错误
当我使用以下行时,我没有收到错误 当
FileItemIterator it = servletFileUpload.getItemIterator(request);
我使用以下行时,我收到错误
List fileItemsList = servletFileUpload.parseRequest(request);
它们有何不同以及 rmi 与 servletFileUpload.parseRequest(request); 有何关系?
错误: 起因:
java.lang.NoClassDefFoundError: java.rmi.server.UID 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:51)
at org.apache.commons.fileupload.disk.DiskFileItem.(DiskFileItem.java:103)
at org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:196)
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:358)
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
at morefile.CopyOfUploadApp.doPost(CopyOfUploadApp.java:147)
背景: 在 Google Apps 上使用 Apache commons lib 的文件上传应用程序。
I dont get the error when I use the following line
FileItemIterator it = servletFileUpload.getItemIterator(request);
I get it when I use following line
List fileItemsList = servletFileUpload.parseRequest(request);
How are they different and How is rmi related to servletFileUpload.parseRequest(request);?
Error:
Caused by:
java.lang.NoClassDefFoundError: java.rmi.server.UID 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:51)
at org.apache.commons.fileupload.disk.DiskFileItem.(DiskFileItem.java:103)
at org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:196)
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:358)
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
at morefile.CopyOfUploadApp.doPost(CopyOfUploadApp.java:147)
Context:
A file upload application using Apache commons lib on google apps.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Commons FileUpload (1.2.1) 仅与 GAE 半兼容。仅支持流 API,但不支持传统 API,因为 GAE 不提供本地文件系统。在 stacktace 中,我看到 DiskFileItem 的用法,它基本上将上传的文件写入本地并稍后删除。
请参阅 Apache Commons FileUpload 下的部分,网址为 GAE 和对 Java 框架的支持
这是流 API 用法。
Commons FileUpload (1.2.1) is only semi-compatible with GAE. Only streaming API is supported but not the traditional API beacuse a local filesystem is not made available by GAE. In the stacktace, I see usage of DiskFileItem, which basically writes the uploaded file locally and deletes it later.
See the section under Apache Commons FileUpload at GAE and support for Java frameworks
Here's the streaming API usage.
Commons FileUpload 库中的 DiskFileItem 类在内部使用 java.rmi.server.UID,并且 Google Apps 运行时环境禁止使用此类。由于 DiskFileItem 正在服务器文件系统上缓存上传的文件,并且 Google Apps 无论如何都禁止磁盘访问,因此删除对 RMI 特定 UID 类的依赖关系并不能解决您的问题。
The DiskFileItem class from the Commons FileUpload library uses java.rmi.server.UID internally and usage of this class is forbidden by the Google Apps runtime environment. Since DiskFileItem is caching the uploaded file on the server file system and disk access is forbidden by Google Apps anyway, removing the dependency on the RMI specific UID class won't solve your problem.