Tag Archives: HTTP Status 500 – Servlet.init()

HTTP status 500 – servlet. Init () [How to Solve]

HTTPStatus500-Servlet.init()forservletspringmvcthrewexception
typeExceptionreport
messageServlet.init()forservletspringmvcthrewexception
descriptionTheserverencounteredaninternalerrorthatpreventeditfromfulfillingthisrequest.
exception
javax.servlet.ServletException:Servlet.init()forservletspringmvcthrewexception
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	java.util.concurrent.ThreadPoolExecutor.runWorker(UnknownSource)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(UnknownSource)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(UnknownSource)
rootcause
org.springframework.beans.factory.CannotLoadBeanClassException:Cannotfindclass[org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping.class]forbeanwithname'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping.class#0'definedinServletContextresource[/WEB-INF/springmvc-servlet.xml];nestedexceptionisjava.lang.ClassNotFoundException:org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping.class
	org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1262)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
	org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)
	org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:588)
	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472)
	org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
	javax.servlet.GenericServlet.init(GenericServlet.java:158)
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	java.util.concurrent.ThreadPoolExecutor.runWorker(UnknownSource)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(UnknownSource)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(UnknownSource)
rootcause
java.lang.ClassNotFoundException:org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping.class
	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1858)
	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
	org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
	org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:417)
	org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1283)
	org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1254)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
	org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)
	org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:588)
	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472)
	org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
	javax.servlet.GenericServlet.init(GenericServlet.java:158)
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	java.util.concurrent.ThreadPoolExecutor.runWorker(UnknownSource)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(UnknownSource)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(UnknownSource)
noteThefullstacktraceoftherootcauseisavailableintheApacheTomcat/7.0.68logs.





Solution.
1 web.xml or other xml configuration class-name, after not in the appearance of .class, only the name can be.
2. remove tomcat server, and then create a new server.
3. redeploy, success.
PS: The encoding of jsp file is utf-8
In addition, there are several errors, the main reason is that the code is not standardized, there are errors, you should carefully check their code, correct the bugs basically nothing wrong