Web tier: servlets, JSP, Web frameworks: Cannot use classes from the com.oreilly.servlet package

  1. Hi there,

    When I use classes from the com.oreilly.servlet package, I get this error:


    javax.servlet.ServletException: Cannot allocate servlet instance for path /test/servlet/UploadTest

    root cause

    java.lang.NoClassDefFoundError: com/oreilly/servlet/MultipartRequest
    at java.lang.Class.newInstance0(Native Method)

    What is the problem and how can I solve it? Is it because of Tomcat's classpath?

    Thank you in advance.
  2. Yup. Just make sure you have the jar file that contains com/oreilly/servlet/MultipartRequest in your classpath and you should be fine.