Results 1 to 5 of 5
  1. #1
    thotacs is offline Member
    Join Date
    Apr 2014
    Posts
    1
    Rep Power
    0

    Default File Upload Control In JSP, Servlets

    Hi,
    I am working on a e-Healthcare project and as a part of it trying to create a file upload control which helps patients to upload documents to the database but i am getting the following error. Any help will be appreciated.

    Regards,
    Chandra

    Error Details
    HTTP Status 500 - Error instantiating servlet class controller.DocUpload

    type Exception report

    message Error instantiating servlet class controller.DocUpload

    description The server encountered an internal error that prevented it from fulfilling this request.

    exception

    javax.servlet.ServletException: Error instantiating servlet class controller.DocUpload
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:103)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:293)
    org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:861)
    org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:606)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:489)
    java.lang.Thread.run(Unknown Source)
    root cause

    java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
    java.lang.Class.getDeclaredConstructors0(Native Method)
    java.lang.Class.privateGetDeclaredConstructors(Unk nown Source)
    java.lang.Class.getConstructor0(Unknown Source)
    java.lang.Class.newInstance0(Unknown Source)
    java.lang.Class.newInstance(Unknown Source)
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:103)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:293)
    org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:861)
    org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:606)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:489)
    java.lang.Thread.run(Unknown Source)
    root cause

    java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileItemFactory
    org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1680)
    org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1526)
    java.lang.Class.getDeclaredConstructors0(Native Method)
    java.lang.Class.privateGetDeclaredConstructors(Unk nown Source)
    java.lang.Class.getConstructor0(Unknown Source)
    java.lang.Class.newInstance0(Unknown Source)
    java.lang.Class.newInstance(Unknown Source)
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:103)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:293)
    org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:861)
    org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:606)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:489)
    java.lang.Thread.run(Unknown Source)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.39 logs.

    Apache Tomcat/6.0.39

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,856
    Rep Power
    19

    Default Re: File Upload Control In JSP, Servlets

    "ClassNotFoundException: org.apache.commons.fileupload.FileItemFactory"

    If you're writing web apps then the above should not be a mystery.
    That class is not on your classpath.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,758
    Rep Power
    5

    Default Re: File Upload Control In JSP, Servlets

    Seems pretty obvious to me, you forgot to include the commons FileUpload jar in your web application's deployment.

    If you are doing Java web development and you don't even know how to recognize and solve a ClassNotFound error (basic Java stuff), you're biting off way more than you can chew and you're going to have a very bad time until you take a few steps back and learn some more basics of the platform.

    EDIT: hah! You win this round Tolls...
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,856
    Rep Power
    19

    Default Re: File Upload Control In JSP, Servlets

    Why are you answering questions that have already been answered?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,758
    Rep Power
    5

    Default Re: File Upload Control In JSP, Servlets

    ... and because you're new you wanted to get you post count up?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. JSP File Upload
    By maas in forum JavaServer Pages (JSP) and JSTL
    Replies: 6
    Last Post: 07-09-2010, 11:07 AM
  2. Trying upload file
    By johniem in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 07-01-2010, 10:31 AM
  3. :large file upload to server(chunk upload)
    By tommy_725 in forum Networking
    Replies: 0
    Last Post: 10-16-2009, 12:21 AM
  4. File Access Through Servlets
    By bipinkrishna15 in forum Java Servlet
    Replies: 1
    Last Post: 05-27-2008, 10:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •