commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 24995] New: - Cannot get FileUpload working with Tomcat 4.1
Date Tue, 25 Nov 2003 22:50:19 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24995>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24995

Cannot get FileUpload working with Tomcat 4.1

           Summary: Cannot get FileUpload working with Tomcat 4.1
           Product: Commons
           Version: 1.1 Final
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: File Upload
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: mehulks@hotmail.com


I am using Tomcat 4.1 and Commons-FileUpload api. I cant get it working. I get 
the following error:


HTTP Status 500 - Internal Server Error

--------------------------------------------------------------------------------

type Exception report

message Internal Server Error

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

exception 

javax.servlet.ServletException: Servlet execution threw an exception
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:256)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:191)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
        at org.apache.catalina.valves.CertificatesValve.invoke
(CertificatesValve.java:246)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2417)
        at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:171)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
        at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:172)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.connector.http.HttpProcessor.process
(HttpProcessor.java:1040)
        at org.apache.catalina.connector.http.HttpProcessor.run
(HttpProcessor.java:1151)
        at java.lang.Thread.run(Thread.java:479)
root cause 

java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
        at mehul.servlet.fileupload.FileUploadServlet.doPost
(FileUploadServlet.java:43)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:256)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:191)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
        at org.apache.catalina.valves.CertificatesValve.invoke
(CertificatesValve.java:246)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2417)
        at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:171)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
        at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:172)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.connector.http.HttpProcessor.process
(HttpProcessor.java:1040)
        at org.apache.catalina.connector.http.HttpProcessor.run
(HttpProcessor.java:1151)
        at java.lang.Thread.run(Thread.java:479)

--------------------------------------------------------------------------------

Apache Tomcat/4.1.29
 

================================================================================
=

 

My HTML looks like:

 

 

<HTML>

<HEAD></HEAD>

<BODY>

<BR>

<CENTER>

<P>

UPLAOD A DOCUMENT FILE ON THE SERVER

</P>

<BR>

<FORM METHOD="POST" ENCTYPE="MULTIPART/FORM-DATA" ACTION="FileUploadServlet">

<!-- <FORM NAME="UPLOADFORM" METHOD="POST" ACTION="FileUploadServlet"> -->

<INPUT TYPE="FILE" NAME="UPLOADFILENAME">

<BR>

<INPUT TYPE="TEXT" NAME="TEST" VALUE="AAAAAAAAA">

<BR>

<BR>

<INPUT TYPE="SUBMIT" VALUE="UPLOAD">

</FORM>

</CENTER>

</BODY>

</HTML>

 

My code looks like:

 

            public void doPost(HttpServletRequest request, HttpServletResponse 
response)

                                                            throws 
ServletException, IOException {

 

                        try {

                                    boolean isMultipart = 
FileUpload.isMultipartContent(request);

 

                                    if(isMultipart == true) {

 

                                                DiskFileUpload upload = new 
DiskFileUpload();

                                                List items = upload.parseRequest
(request, 1024*4, 1024*2000, "c:\\temp");

 

                                                Iterator iter = items.iterator
();

 

                                                while (iter.hasNext()) {

 

                                                            FileItem item = 
(FileItem) iter.next();

 

                                                            if (item.isFormField
()) {

                                                                        String 
name = item.getFieldName();

                                                                        String 
value = item.getString();

                                                                        
System.out.println("Name = " + name);

                                                                        
System.out.println("Value = " + value);

                                                            }

                                                            else {

                                                                        String 
fieldName = item.getFieldName();

                                                                        String 
fileName = item.getName();

                                                                        String 
contentType = item.getContentType();

                                                                        boolean 
isInMemory = item.isInMemory();

                                                                        long 
sizeInBytes = item.getSize();

                                                                        File 
uploadedFile = new File("c:\\mehul\\ssl\\" + fileName);

                                                                        
item.write(uploadedFile);

                                                            }

                                                }

                                    }

 

                                    request.getRequestDispatcher
("UploadResponse").forward(request, response);

                        }

                        catch(Exception e) {

                                    e.printStackTrace();

                        }

            }

 

 

The servlet.jar file is in server/lib directory. I am running on windows xp 
machine.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message