Error casting servlet: “main” to javax.servlet.Servlet

By : rose

Please suggest me to resoleve the error.In my project using struts,spring.I am getting this error when running the apps.

<Error> <HTTP> <BEA-101126> <[ServletContext(id=15938176,name=efund,context-    path=/efund)] Error casting servlet: "main" to javax.servlet.Servlet
at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
at   org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(
     <BEA-101216> <Servlet: "action" failed to preload on startup in Web  application: "efund".

Please let me know , what is the problem in my project ?

Thank you in advance.

By : rose


Either HIMain doesn't extend GenericServlet or HttpServlet, or your application is including its own copy of the Servlet API. The latter can cause classloading problems like this one.

Make sure you don't have servlet-api.jar (or something like it) in your application.

By : skaffman

This video can help you solving your question :)
By: admin