You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Damian Murtha <dm...@hotmail.com> on 2003/04/25 17:52:07 UTC
FileUpload
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
Re: FileUpload
Posted by Martin Cooper <ma...@apache.org>.
That is really, really weird! The NPE is being thrown apparently because
Object.getClass() returned null within the FileUpload instance. I have no
clue how that could ever happen, outside of a compiler or JVM bug.
Would it be possible for you to try your web app with another JDK and JVM,
to see if you can isolate the source of the problem?
--
Martin Cooper
On Fri, 25 Apr 2003, Damian Murtha wrote:
> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>