hello friends,

i am using apache tomcat 6.0, jdk 6, and i want to upload .doc files to 
cloudscape 10 database.
 
before sending them over to database i tried the following code to upload
files
to tomcat (web server)


upload1.jsp---->
__________________________________________________________
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Upload 1</title>
</head>
<body>
<form action="http://localhost:8080/CloudscapeDemo/upload2.jsp";
method="post"
enctype="multipart/form-data">
<input type="file" name="docfile1" />
<input type="file" name="docfile2" />
<input type="file" name="docfile3" />
<input type="submit" value="Upload" />
</form>
</body>
</html>
____________________________

and the jsp for handling the uploaded data upload2.jsp is  ---->
________________________________________________
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page import="org.apache.commons.fileupload.servlet.*"%>
<%@ page import="org.apache.commons.fileupload.disk.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Upload 2</title>
</head>
<body>
<%
String docfilename = "";
long docsize = 0;
String contentsdf = "";

DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload fu = new ServletFileUpload(factory);
List fileItems = fu.parseRequest(request);

out.println("TOTALFILES:" + fileItems.size() + "<br>");

Iterator itr = fileItems.iterator();

fu.setSizeMax(1000000); // throw exception if > 1 Mb

while (itr.hasNext()) {
FileItem fi = (FileItem) itr.next();

if (!fi.isFormField()) {
// only process files here, not form fields
docfilename = fi.getName();
docsize = fi.getSize();
contentsdf = fi.getString();
}
if (docsize > 0) {
out.println("FILENAME:" + docfilename + "<br>");
out.println("FILESIZE:" + docsize + "<br>");
out.println("FILECONTENT:" + contentsdf + "<br>");
}
}
%>
</body>
</html>
____________________________________________

on pressing the submit button tomcat shows following errors:-----
_________________________________

description The server encountered an internal error () that prevented it
from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.servlet.ServletException:
java.lang.NoClassDefFoundError:
org/apache/commons/io/output/DeferredFileOutputStream

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

javax.servlet.ServletException: java.lang.NoClassDefFoundError:
org/apache/commons/io/output/DeferredFileOutputStream

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
        
org.apache.jsp.CloudscapeDemo.upload2_jsp._jspService(upload2_jsp.java:107)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
____________________________________________
 

i can't figure out whether there is a problem with the code or with my
 tomcat installation (class not found).
i am fretting over it for 2 days now. please help

thanks in advance





 
-- 
View this message in context: 
http://www.nabble.com/problem-using-fileupload-utility-tf4616599.html#a13184745
Sent from the Commons - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to