You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Дмитрий Можейко <mo...@mail.ru> on 2006/01/17 09:24:37 UTC

Re[2]: FileUpload: java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream

I put commons-fileupload-1.1.jar into WEB-INF/lib directory, but receive same error:(


-----Original Message-----
From: Martin Cooper <ma...@apache.org>
To: Jakarta Commons Users List <co...@jakarta.apache.org>, Дмитрий Можейко <mo...@mail.ru>
Date: Fri, 13 Jan 2006 08:57:49 -0800
Subject: Re: FileUpload: java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream

> You need to put the Commons FileUpload jar (and the Commons IO jar) in the
> WEB-INF/lib directory of your web app. The problem you are seeing is almost
> certainly because you are trying to use FileUpload from a shared location
> instead of including it in your web app.
> 
> --
> Martin Cooper
> 
> 
> On 1/13/06, Дмитрий Можейко <mo...@mail.ru> wrote:
> >
> > I wrote web-application with servlet to file uploading.
> >
> > This is code-fragment:
> >
> > ...
> > 41:   FileItemFactory factory = new DiskFileItemFactory();
> >
> > 43:    ServletFileUpload upload = new ServletFileUpload(factory);
> >
> > 45:    List items = upload.parseRequest(request);
> > ...
> >
> > I put commons-fileupload-1.1.jar ${APPSRVHOME}/domains/domain1/lib/ext/
> > directory and success fully deploy it into Sun Java System Application
> > Server Platform Edition 8.1_02 (build b06-fcs)
> >
> > but i receive this runtime error:
> >
> > java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
> >
> > org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(
> > ServletFileUpload.java:116)
> >         web.UploadServlet.processRequest(UploadServlet.java:45)
> >         web.UploadServlet.doPost(UploadServlet.java:74)
> >         javax.servlet.http.HttpServlet.service(HttpServlet.java:767)
> >         javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
> >         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         sun.reflect.NativeMethodAccessorImpl.invoke(
> > NativeMethodAccessorImpl.java:39)
> >         sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:25)
> >         java.lang.reflect.Method.invoke(Method.java:585)
> >         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java
> > :249)
> >         java.security.AccessController.doPrivileged(Native Method)
> >         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
> >         org.apache.catalina.security.SecurityUtil.execute(
> > SecurityUtil.java:282)
> >         org.apache.catalina.security.SecurityUtil.doAsPrivilege(
> > SecurityUtil.java:165)
> >
> >
> > Why?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
> 


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


Re: Re[2]: FileUpload: java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream

Posted by Jacob Kjome <ho...@visi.com>.
Quoting äÍÉÔÒÉÊ íÏÖÅÊËÏ <mo...@mail.ru>:

> I put commons-fileupload-1.1.jar into WEB-INF/lib directory, but receive same
> error:(
>

Did you remember to remove the commons-fileupload from
${APPSRVHOME}/domains/domain1/lib/ext/?  If not, then do that and try again. 
The point is, commons-fileupload should not be on any global classpath
location, *only* the webapp's location.  Note that if you were using Tomcat, it
probably would have worked anyway since it uses child-first classloading
behavior by default, but you still need to be wary about putting anything in a
global extensions directory.  Most servers will blow chuncks even if you turn
on optional child-first classloading behavior because they are almost always
implemented poorly.  Tomcat is the only server I trust to do it right because
child-first is its default behavior.

Jake

>
> -----Original Message-----
> From: Martin Cooper <ma...@apache.org>
> To: Jakarta Commons Users List <co...@jakarta.apache.org>, äÍÉÔÒÉÊ
> íÏÖÅÊËÏ <mo...@mail.ru>
> Date: Fri, 13 Jan 2006 08:57:49 -0800
> Subject: Re: FileUpload: java.lang.NoClassDefFoundError:
> javax/servlet/ServletInputStream
>
> > You need to put the Commons FileUpload jar (and the Commons IO jar) in the
> > WEB-INF/lib directory of your web app. The problem you are seeing is almost
> > certainly because you are trying to use FileUpload from a shared location
> > instead of including it in your web app.
> >
> > --
> > Martin Cooper
> >
> >
> > On 1/13/06, äÍÉÔÒÉÊ íÏÖÅÊËÏ <mo...@mail.ru> wrote:
> > >
> > > I wrote web-application with servlet to file uploading.
> > >
> > > This is code-fragment:
> > >
> > > ...
> > > 41:   FileItemFactory factory = new DiskFileItemFactory();
> > >
> > > 43:    ServletFileUpload upload = new ServletFileUpload(factory);
> > >
> > > 45:    List items = upload.parseRequest(request);
> > > ...
> > >
> > > I put commons-fileupload-1.1.jar ${APPSRVHOME}/domains/domain1/lib/ext/
> > > directory and success fully deploy it into Sun Java System Application
> > > Server Platform Edition 8.1_02 (build b06-fcs)
> > >
> > > but i receive this runtime error:
> > >
> > > java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
> > >
> > > org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(
> > > ServletFileUpload.java:116)
> > >         web.UploadServlet.processRequest(UploadServlet.java:45)
> > >         web.UploadServlet.doPost(UploadServlet.java:74)
> > >         javax.servlet.http.HttpServlet.service(HttpServlet.java:767)
> > >         javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
> > >         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >         sun.reflect.NativeMethodAccessorImpl.invoke(
> > > NativeMethodAccessorImpl.java:39)
> > >         sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > > DelegatingMethodAccessorImpl.java:25)
> > >         java.lang.reflect.Method.invoke(Method.java:585)
> > >         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java
> > > :249)
> > >         java.security.AccessController.doPrivileged(Native Method)
> > >         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
> > >         org.apache.catalina.security.SecurityUtil.execute(
> > > SecurityUtil.java:282)
> > >         org.apache.catalina.security.SecurityUtil.doAsPrivilege(
> > > SecurityUtil.java:165)
> > >
> > >
> > > Why?
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> > >
> > >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>




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