javax.servlet.ServletException: Error instantiating servlet class

ashok Priyadarshan
ashok Priyadarshan used Ask the Experts™
on
I created a  JSP page to upload files from this  example:
https://www.javacodegeeks.com/2013/08/file-upload-example-in-servlet-and-jsp.html

I followed this to the T and it comes back with this error message after I click on upload. I have enclosed the complete source int the ZIP with the pom file

Here is the error:

HTTP Status 500 – Internal Server Error
Type Exception Report

Message Error instantiating servlet class [FileUploadHandler]

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Error instantiating servlet class [FileUploadHandler]
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
      org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
      org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
      org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468)
      org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      java.lang.Thread.run(Thread.java:745)
Root Cause

java.lang.ClassNotFoundException: FileUploadHandler
      org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308)
      org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1136)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
      org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
      org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
      org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468)
      org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      java.lang.Thread.run(Thread.java:745)
Note The full stack trace of the root cause is available in the server logs.

Apache Tomcat/8.5.31
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Root Cause   java.lang.ClassNotFoundException: FileUploadHandler

I assume that you compiled the FileUploadHandler.java  file. Please tell us where in your web app  you placed the class file.

Author

Commented:
it is in the zip
Distinguished Expert 2018

Commented:
Can you tell us the location of this class in the .war file?

Commented:
I don't see any zip. Anyway, you should post your code files and screenshots here. Use the tags that are above the comment text box.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial