commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Damian Murtha" <dmurth...@hotmail.com>
Subject FileUpload
Date Fri, 25 Apr 2003 15:52:07 GMT
I'm running SUSE 8, iPlanet-WebServer-Enterprise/6.0SP4 and j2sdk1.4.0.  
Including commons-fileupload-1.0-beta-1.jar, commons-beanutils.jar, 
commons-logging.jar, servletapi-2.3.jar.  I keep receiving an error on the 
upload:

failure (11204):  Internal error: servlet service function had thrown 
ServletException (uri=/servlet/HogeSrv): javax.servlet.ServletException: 
java.lang.NullPointerException, stack: javax.servlet.ServletException: 
java.lang.NullPointerException   at HogeSrv.doPost(HogeSrv.java:81)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)   at 
com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:897)

   at 
com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:464) 
   , root cause: org.apache.commons.fileupload.FileUploadException: 
java.lang.NullPointerException   at 
org.apache.commons.fileupload.FileUpload.getNewInstanceMethod(FileUpload.java:656) 
   at 
org.apache.commons.fileupload.FileUpload.createItem(FileUpload.java:600)   
at 
org.apache.commons.fileupload.FileUpload.parseRequest(FileUpload.java:473)   
at 
org.apache.commons.fileupload.FileUpload.parseRequest(FileUpload.java:355)   
at HogeSrv.doPost(HogeSrv.java:40)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)   at 
com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:897)

   at 
com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:464)

The code up until it errors:

import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletInputStream;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUpload;
import org.apache.commons.fileupload.MultipartStream;
import org.apache.commons.beanutils.MethodUtils;

public class HogeSrv extends HttpServlet {

  protected void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {

    try {
      FileUpload fu = new FileUpload();
      fu.setSizeMax(1000000);
      fu.setSizeThreshold(4096);
      fu.setRepositoryPath("/tmp");
-->Error      List  fileItems = fu.parseRequest(req);

HTML:

<html>
<body>
<h2>TEST</h2>
<form name="uploadForm" action="servlet/HogeSrv" method="POST" 
enctype="multipart/form-data">
  <input type="file" name="file1">
  <br><input type="submit">
</form>
</body>
</html>

I checked the paths of all installed API's and I have full permisions for 
the /tmp folder and API's.  The most I could do was retrieve the name of the 
file uploading. Anyone suggestions?








_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail


Mime
View raw message