简体   繁体   English

将Servlet:“ main”强制转换为javax.servlet.Servlet时出错

[英]Error casting servlet: “main” to javax.servlet.Servlet

Please suggest me to resoleve the error.In my project using struts,spring.I am getting this error when running the apps. 请建议我改正错误。在我的使用struts,spring的项目中。运行应用程序时出现此错误。

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

Please let me know , what is the problem in my project ? 请让我知道,我的项目有什么问题?

Thank you in advance. 先感谢您。

Looks pretty straightforward to me. 对我来说看起来很简单。 The class com.thetravel.ld.tools.efund.servlets.HIMain is registered as a servlet called "main", but it doesn't implement javax.servlet.Servlet (ie it isn't a servlet). com.thetravel.ld.tools.efund.servlets.HIMain类已注册为名为“ main”的servlet,但未实现javax.servlet.Servlet (即,它不是servlet)。

Either HIMain doesn't extend GenericServlet or HttpServlet , or your application is including its own copy of the Servlet API. HIMain不会扩展GenericServletHttpServlet或者您的应用程序包括其自己的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. 确保您的应用程序中没有servlet-api.jar (或类似的东西)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 RepositoryRestMvcConfiguration无法强制转换为javax.servlet.Servlet - RepositoryRestMvcConfiguration cannot be cast to javax.servlet.Servlet 使用SpringBootServletInitializer:应用程序不是javax.servlet.Servlet - Using SpringBootServletInitializer: Application is not a javax.servlet.Servlet UnavailableException: Servlet class 不是带有 Jetty 的 javax.servlet.Servlet - UnavailableException: Servlet class is not a javax.servlet.Servlet with Jetty eclipse servlet java.lang.ClassNotFoundException:javax.servlet.Servlet - eclipse servlet java.lang.ClassNotFoundException: javax.servlet.Servlet 尝试使用 Servlet 打包 REST App 时如何修复“无法转换为 javax.servlet.Servlet”错误 - How to fix 'cannot be cast to javax.servlet.Servlet' error while trying to package REST App with Servlet java.lang.ClassCastException:无法转换为javax.servlet.Servlet - java.lang.ClassCastException: cannot be cast to javax.servlet.Servlet Servlet类com.foobar.jaxrs.application.MyApplication不是javax.servlet.Servlet - Servlet class com.foobar.jaxrs.application.MyApplication is not a javax.servlet.Servlet java.lang.ClassCastException:org.glassfish.jersey.servlet.ServletContainer无法转换为javax.servlet.Servlet - java.lang.ClassCastException: org.glassfish.jersey.servlet.ServletContainer cannot be cast to javax.servlet.Servlet java.lang.ClassCastException:无法将 Servlet.Telnet 转换为 javax.servlet.Servlet - java.lang.ClassCastException: Servlet.Telnet cannot be cast to javax.servlet.Servlet Servlet类引用未实现接口javax.servlet.Servlet的“ org.springframework.web.servlet.DispatcherServlet” - servlet-class references to “org.springframework.web.servlet.DispatcherServlet” that does not implement interface javax.servlet.Servlet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM