You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Peter Lauri <pe...@lauri.se> on 2004/12/29 05:53:05 UTC

FileUpload

Best groupmember,

I have downloaded the CommonFileupload and have problems the thrown errors.
I have put the jar in $catalina_home/shared/lib and in the
$catalina_hom/webapps/myproject/WEB-INF/lib. I have never had problem with
creating servlets, no problems before.

I started out just by the tutorial about using FileUpload at
http://jakarta.apache.org/commons/fileupload/using.html . The first part is
to check if we have a fileupload request (I am certain I have). The code is:

public void doPost (HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
     PrintWriter out = response.getWriter();
     if(FileUpload.isMultipartContent(request)) {
          out.println("Ok, there is a multipart content...");
     } else {
          out.println("No multipart content...");
     }
}

This is the basic part, and it throws an error. I have tried other functions
to and they throw similar errors. People suggest to but the servlet-api.jar
in the CLASS_PATH, but I have it already there since long time. 

Here is the error I get, anyone with experience of the same thing?:

exception 

javax.servlet.ServletException: Invoker service() exception
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
:477)
org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause 

java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
ImageUpload.doPost(ImageUpload.java:56)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
:419)
org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


-- Best of Times
Peter Lauri


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


SV: SV: FileUpload

Posted by Peter Lauri <pe...@lauri.se>.
Do you mean that I should not have the servlet-api.jar in the classpath?

/Peter


-----Ursprungligt meddelande-----
Från: Emmanouil Batsis [mailto:manos_lists@geekologue.com] 
Skickat: den 30 december 2004 19:42
Till: Jakarta Commons Users List
Ämne: Re: SV: FileUpload

On Thursday 30 December 2004 10:11, Peter Lauri wrote:
> I am new to the servlets technology, what is meant with "container config
> problem"?

i think that one possibility is you are including a jar containing the
servlet 
API in your application (you probably use that jar during development to
have 
the related classes in the classpath).

hth,

Manos

---------------------------------------------------------------------
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


SV: SV: FileUpload

Posted by Peter Lauri <pe...@lauri.se>.
I love you all!!!! :)

The solution to the problem was that I had the Commonfileupload jar in both
javas ext and WEB-INF/lib... Now it works ;)

Thanks everybody for the help in this issue...

/Peter


-----Ursprungligt meddelande-----
Från: Emmanouil Batsis [mailto:manos_lists@geekologue.com] 
Skickat: den 30 december 2004 19:42
Till: Jakarta Commons Users List
Ämne: Re: SV: FileUpload

On Thursday 30 December 2004 10:11, Peter Lauri wrote:
> I am new to the servlets technology, what is meant with "container config
> problem"?

i think that one possibility is you are including a jar containing the
servlet 
API in your application (you probably use that jar during development to
have 
the related classes in the classpath).

hth,

Manos

---------------------------------------------------------------------
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: SV: FileUpload

Posted by Emmanouil Batsis <ma...@geekologue.com>.
On Thursday 30 December 2004 10:11, Peter Lauri wrote:
> I am new to the servlets technology, what is meant with "container config
> problem"?

i think that one possibility is you are including a jar containing the servlet 
API in your application (you probably use that jar during development to have 
the related classes in the classpath).

hth,

Manos

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


SV: FileUpload

Posted by Peter Lauri <pe...@lauri.se>.
I am new to the servlets technology, what is meant with "container config
problem"?


-----Ursprungligt meddelande-----
Från: Martin Cooper [mailto:mfncooper@gmail.com] 
Skickat: den 29 december 2004 13:09
Till: Jakarta Commons Users List
Ämne: Re: FileUpload

The right place for the FileUpload jar file is the WEB-INF/lib
directory of your web application.

It's worth noting that the stack traces for the exception you are
seeing do not include Commons FileUpload, so I'm not clear on why you
think the problem is related to that component. Rather, the missing
class seems to be one that is part of the Servlet API, suggesting a
container config problem.

--
Martin Cooper


On Wed, 29 Dec 2004 11:53:05 +0700, Peter Lauri <pe...@lauri.se> wrote:
> Best groupmember,
> 
> I have downloaded the CommonFileupload and have problems the thrown
errors.
> I have put the jar in $catalina_home/shared/lib and in the
> $catalina_hom/webapps/myproject/WEB-INF/lib. I have never had problem with
> creating servlets, no problems before.
> 
> I started out just by the tutorial about using FileUpload at
> http://jakarta.apache.org/commons/fileupload/using.html . The first part
is
> to check if we have a fileupload request (I am certain I have). The code
is:
> 
> public void doPost (HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException {
>     PrintWriter out = response.getWriter();
>     if(FileUpload.isMultipartContent(request)) {
>          out.println("Ok, there is a multipart content...");
>     } else {
>          out.println("No multipart content...");
>     }
> }
> 
> This is the basic part, and it throws an error. I have tried other
functions
> to and they throw similar errors. People suggest to but the
servlet-api.jar
> in the CLASS_PATH, but I have it already there since long time.
> 
> Here is the error I get, anyone with experience of the same thing?:
> 
> exception
> 
> javax.servlet.ServletException: Invoker service() exception
>
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
> :477)
>
org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> root cause
> 
> java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
> ImageUpload.doPost(ImageUpload.java:56)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
> :419)
>
org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> -- Best of Times
> Peter Lauri
> 
> ---------------------------------------------------------------------
> 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


Re: FileUpload

Posted by Martin Cooper <mf...@gmail.com>.
The right place for the FileUpload jar file is the WEB-INF/lib
directory of your web application.

It's worth noting that the stack traces for the exception you are
seeing do not include Commons FileUpload, so I'm not clear on why you
think the problem is related to that component. Rather, the missing
class seems to be one that is part of the Servlet API, suggesting a
container config problem.

--
Martin Cooper


On Wed, 29 Dec 2004 11:53:05 +0700, Peter Lauri <pe...@lauri.se> wrote:
> Best groupmember,
> 
> I have downloaded the CommonFileupload and have problems the thrown errors.
> I have put the jar in $catalina_home/shared/lib and in the
> $catalina_hom/webapps/myproject/WEB-INF/lib. I have never had problem with
> creating servlets, no problems before.
> 
> I started out just by the tutorial about using FileUpload at
> http://jakarta.apache.org/commons/fileupload/using.html . The first part is
> to check if we have a fileupload request (I am certain I have). The code is:
> 
> public void doPost (HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException {
>     PrintWriter out = response.getWriter();
>     if(FileUpload.isMultipartContent(request)) {
>          out.println("Ok, there is a multipart content...");
>     } else {
>          out.println("No multipart content...");
>     }
> }
> 
> This is the basic part, and it throws an error. I have tried other functions
> to and they throw similar errors. People suggest to but the servlet-api.jar
> in the CLASS_PATH, but I have it already there since long time.
> 
> Here is the error I get, anyone with experience of the same thing?:
> 
> exception
> 
> javax.servlet.ServletException: Invoker service() exception
> org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
> :477)
> org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> root cause
> 
> java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
> ImageUpload.doPost(ImageUpload.java:56)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
> :419)
> org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> -- Best of Times
> Peter Lauri
> 
> ---------------------------------------------------------------------
> 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