I fixed the issue by adding servlet-api.jar to the jre/lib/ext directory, but this does not seem like the best solution. Shouldn't Tomcat load its own libs before running the web app?
On Wed, Dec 17, 2008 at 7:42 PM, Robert Christian < [email protected]> wrote: > I found someone else with the same issue (using fileupload): > http://forums.sun.com/thread.jspa?threadID=5352575. They didn't have a > clear resolution, just reported that they "cleaned up." > > I reinstalled tomcat6 from scratch and ran the app in standalone (deployed > to tomcat, no eclipse), and the issue persisted. > > I verified that $TOMCAT_HOME/lib contains the servlet-api.jar, which > contains the javax/servlet/http/HttpServletRequest class. > > Here's the response: > > HTTP Status 500 - > > type Exception report > > message > > description The server encountered an internal error () that prevented > it from fulfilling this request. > > exception > > javax.servlet.ServletException: Servlet execution threw an exception > > root cause > > java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest > > org.apache.commons.fileupload.servlet.ServletFileUpload.isMultipartContent(ServletFileUpload.java:68) > com.iojunky.core.UploadServlet.doPost(UploadServlet.java:54) > javax.servlet.http.HttpServlet.service(HttpServlet.java:710) > javax.servlet.http.HttpServlet.service(HttpServlet.java:803) > > note The full stack trace of the root cause is available in the Apache > Tomcat/6.0.14 logs. > > So, Tomcat says it can't find a class that is clearly in the path. Any > ideas would be helpful. > > On Fri, Dec 12, 2008 at 6:26 PM, Martin Cooper <[email protected]> wrote: > >> On Fri, Dec 12, 2008 at 6:21 PM, Robert Christian < >> [email protected]> wrote: >> >> > The stack output is from the Tomcat layer: >> >> >> I see nothing in that stack trace that suggests any connection to >> FileUpload. What makes you think there's a connection? >> >> -- >> Martin Cooper >> >> >> >> > SEVERE: Servlet.service() for servlet hello threw exception >> > javax.servlet.ServletException: Servlet execution threw an exception >> > at >> > >> > >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:313) >> > at >> > >> > >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) >> > at >> > >> > >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) >> > at >> > >> > >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) >> > at >> > >> > >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) >> > at >> > >> > >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) >> > at >> > >> > >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) >> > at >> > >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) >> > at >> > >> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) >> > at >> > >> > >> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) >> > at >> > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) >> > at java.lang.Thread.run(Thread.java:619) >> > >> > The root exception is a java.security.AccessControlException. I am >> using >> > the out-of-the-box catalina.policy. >> > >> > On Thu, Dec 11, 2008 at 10:44 PM, Robert Christian < >> > [email protected]> wrote: >> > >> > > exception occurs at >> > ApplicationFilterChain.internalDoFilter(ServletRequest, >> > > ServletResponse) line: 310 >> > > >> > > using tomcat 6 >> > > commons-fileupload-1.2.1 >> > > commons-io-1.3.2 >> > > >> > > code looks like: >> > > >> > > public void doPost(HttpServletRequest req, HttpServletResponse res) >> > > throws ServletException, IOException { >> > > >> > > try { >> > > // Check that we have a file upload request >> > > boolean isMultipart = >> > > ServletFileUpload.isMultipartContent(req); >> > > >> > > // Create a new file upload handler >> > > ServletFileUpload upload = new ServletFileUpload(); >> > > >> > >> > >
