Hallo George,
Firstly thank you for your respond.
I edit my 'cgiupload.jsp' code but it still does not run as expected.
This one is wrong :
"
org/apache/commons/io/output/DeferredFileOutputStream
"
because DeferredFileOutputStream is placed here:
"
org/apache/commons/fileupload/DeferredFileOutputStream
".
But why does 'import="org.apache.commons.fileupload.* still produces
mistake? I can not understand.
Please tell me where is the mistake.
Thank you very much
====
//my new 'cgiupload.jsp'.
<%@ page import="java.util.List, java.io.File, java.util.Iterator,
org.apache.commons.fileupload.DeferredFileOutputStream,
org.apache.commons.fileupload.DiskFileUpload,
org.apache.commons.fileupload.FileUploadBase,
org.apache.commons.fileupload.FileUpload,
org.apache.commons.fileupload.FileItem" %>
<%
boolean isMultipart = FileUpload.isMultipartContent(request);
if(!isMultipart){
request.setAttribute("msg", "Request was not multipart!");
request.getRequestDispatcher("msg.jsp").forward(request, response);
return;
}
DiskFileUpload upload = new DiskFileUpload();
List items = upload.parseRequest(request);
Iterator itr = items.iterator();
while(itr.hasNext()){
FileItem item = (FileItem) itr.next();
if(item.isFormField()) {
String fieldName = item.getFieldName();
if(fieldName.equals("name"))
request.setAttribute("msg", "Thank You: " + item.getString());
} else {
File fullFile = new File(item.getName());
File savedFile = new File(getServletContext().getRealPath("/"),
fullFile.getName());
item.write(savedFile);
}
}
request.getRequestDispatcher("msg.jsp").forward(request, response);
%>
===
//The new error message:
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
Only a type can be imported.
org.apache.commons.fileupload.DeferredFileOutputStream resolves to a package
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
Only a type can be imported.
org.apache.commons.fileupload.DeferredFileOutputStream resolves to a package
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:413)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.16 logs.
--------------------------------------------------------------------------------
Apache Tomcat/5.5.16
----- Original Message -----
From: "George Stoianov"
root cause
java.lang.NoClassDefFoundError:
org/apache/commons/io/output/DeferredFileOutputStream
Hi the above line is most probably the cause for your problem. Please open the fileupload.jar in Konqueror and search for this class if it is not there grab a different version and try it again.
I would advice you to do it with a smaller file in the beginning.
Regards, George
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e