File Upload Problem - java.lang.NoClassDefFoundError: Could not initialize class org.apache.commons.fileupload.disk.DiskFileItem

238 views
Skip to first unread message

Nishant

unread,
Mar 22, 2012, 11:59:36 AM3/22/12
to google-we...@googlegroups.com
Hi,

I have problem with the File Upload in GWT using the Apache Commons
File Upload.

I am using Windows XP + Eclipse Indigo + GWT for Eclipse Indigo.
I have the following jars in my Build Path and the war/WEB-INF/lib
commons-fileupload-1.2.3.jar
commons-io-2.1.jar


I am trying to upload file from the client to server following the
code on this link http://commons.apache.org/fileupload/using.html

But every time I try to upload a file I get one of the following
errors

java.lang.NoClassDefFoundError: Could not initialize class
org.apache.commons.fileupload.disk.DiskFileItem
       at
org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:
199)
       at
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:
361)
       at
org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:
126)
       at
com.tibco.gwt.server.FileUploadServlet.doPost(FileUploadServlet.java:
28)

or

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.<clinit>(DiskFileItem.java:
109)
       at
org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:
199)
       at
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:
361)
       at
org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:
126)
       at
com.tibco.gwt.server.FileUploadServlet.doPost(FileUploadServlet.java:
28)

The error is always at the following line:
// Parse the request
List /* FileItem */ items = upload.parseRequest(request);


Can any of you experts let me the solution for this problem.

Regards,
Nishant 
Reply all
Reply to author
Forward
0 new messages