HTTP Status 500 - Servlet.init() for servlet spring-dispatcher threw exception_(spring-dispatcher-servlet is good) The Next CEO of Stack OverflowWhat is Dispatcher Servlet in Spring?Spring Security with OpenIDAuthenticationFilter problemSpring MVC: Controller RequestMapping working, but return always gives a 404Issue configuring hibernate in my Spring Applicationnested exception is java.lang.NoClassDefFoundError: Could not initialize class org.springframework.jdbc.support.SQLErrorCodesFactorySpring 4 No mapping found for HTTP requestSpring MVC + MongoDBIntelliJ + Spring Web MVCHow can we call requestmethod=POST method in Spring MVC?Spring MVC - HTTP Status 500

Calculate the Mean mean of two numbers

how one can write a nice vector parser, something that does pgfvecparseA=B-C; D=E x F;

Won the lottery - how do I keep the money?

TikZ: How to fill area with a special pattern?

Easy to read palindrome checker

Does the Idaho Potato Commission associate potato skins with healthy eating?

Can I board the first leg of the flight without having final country's visa?

Film where the government was corrupt with aliens, people sent to kill aliens are given rigged visors not showing the right aliens

Help/tips for a first time writer?

Why am I getting "Static method cannot be referenced from a non static context: String String.valueOf(Object)"?

Small nick on power cord from an electric alarm clock, and copper wiring exposed but intact

How do I fit a non linear curve?

Traveling with my 5 year old daughter (as the father) without the mother from Germany to Mexico

The Ultimate Number Sequence Puzzle

How did Beeri the Hittite come up with naming his daughter Yehudit?

What are the unusually-enlarged wing sections on this P-38 Lightning?

Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?

Why is information "lost" when it got into a black hole?

what's the use of '% to gdp' type of variables?

What CSS properties can the br tag have?

What was Carter Burke's job for "the company" in Aliens?

From jafe to El-Guest

Why do we say 'Un seul M' and not 'Une seule M' even though M is a "consonne"

Does higher Oxidation/ reduction potential translate to higher energy storage in battery?



HTTP Status 500 - Servlet.init() for servlet spring-dispatcher threw exception_(spring-dispatcher-servlet is good)



The Next CEO of Stack OverflowWhat is Dispatcher Servlet in Spring?Spring Security with OpenIDAuthenticationFilter problemSpring MVC: Controller RequestMapping working, but return always gives a 404Issue configuring hibernate in my Spring Applicationnested exception is java.lang.NoClassDefFoundError: Could not initialize class org.springframework.jdbc.support.SQLErrorCodesFactorySpring 4 No mapping found for HTTP requestSpring MVC + MongoDBIntelliJ + Spring Web MVCHow can we call requestmethod=POST method in Spring MVC?Spring MVC - HTTP Status 500










0















I am creating a sample website for College last time when i ran the code it was running fine but when i ran it after some time I got this Error
"HTTP Status 500 - Servlet.init() for servlet spring-dispatcher threw exception"



Error Messages -




type Exception report



message Servlet.init() for servlet spring-dispatcher threw exception



description The server encountered an internal error that prevented it
from fulfilling this request.



exception



javax.servlet.ServletException: Servlet.init() for servlet
spring-dispatcher threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)



java.lang.Thread.run(Thread.java:748)




Following are the classes which i am working on



spring-dispatcher-servlet.xml -



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">


<context:component-scan base-package="com.newseries.hecontroller" />
<mvc:annotation-driven/>

<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>

</beans>


studentAdmissionController -



package com.newseries.hecontroller;



import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Map;
import java.text.DateFormat;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class studentAdmissionController

@InitBinder
public void initBinder(WebDataBinder binder)
//binder.setDisallowedFields(new String[] "mobileNumber");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy****MM**dd");
binder.registerCustomEditor(Date.class, "newDate", new CustomDateEditor(sdf, false));
//binder.registerCustomEditor(String.class, "firstName", new StudentNameEditor());


@RequestMapping(value="/admissionForm.html", method = RequestMethod.GET)
public ModelAndView getAdmissionForm()
ModelAndView model = new ModelAndView("AdmissionForm");
return model;


@ModelAttribute
public void addcommonmethod(Model model)
model.addAttribute("headermessage", "SIT college of Engineering India");


@RequestMapping(value="/submitAdmissionForm.html", method = RequestMethod.POST)
public ModelAndView submitAdmissionForm(@ModelAttribute("student1") Student student1, BindingResult result)

if(result.hasErrors())
ModelAndView model1 = new ModelAndView("AdmissionForm");
return model1;


ModelAndView model = new ModelAndView("AdmissionSuccess");
return model;




AdmissionForm.jsp -



<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<body>
<h1>$headermessage</h1>
<h2>College Admission Courses</h2>

<form:errors path="student1.*"/>

<form action="/FirstSpringMVCApplication02/submitAdmissionForm.html"
method="post">
<table>
<tr> <td>Student's FirstName : </td> <td> <input type="text" name="firstName" /> </td> </tr>
<tr> <td>Student's LastName : </td> <td> <input type="text" name="lastName" /> </td> </tr>
<tr> <td>Student's Hobby : </td> <td> <input type="text" name="studentHobby" /> </td> </tr>
<tr> <td>Student's MobileNumber : </td> <td> <input type="text" name="mobileNumber" /> </td> </tr>
<tr> <td>Student DOB : </td> <td> <input type="text" name="newDate" /> </td> </tr>
<tr> <td>Student skillSet : </td> <td> <select name="studentSkills" multiple>
<option value="CoreJava">Core Java</option>
<option value="SpringMVC">SpringMVC</option>
<option value="SpringIOC">SpringIOC</option>
<option value="SpringAOP">SpringAOP</option>
<option value="SpringDAO">SpringDAO</option>
<option value="SpringBoot">SpringBoot</option>
<option value="Multithreading">Multithreading</option>
<option value="Collection">Collection</option>
<option value="Oops">Oops</option>
<option value="Hibernate">Hibernate</option>
</select></td> </tr>
</table>
<table>
<tr>
<td>Student's Address :</td>
</tr>

<tr>
<td>Country: <input type="text" name="studentAddress.country" /></td>
<td>City : <input type="text" name="studentAddress.city" /></td>
<td>Street : <input type="text" name="studentAddress.city" /></td>
<td>pinCode: <input type="text" name="studentAddress.pinCode" /></td>
</tr>

</table>

<input type="submit" value="Submit" />
</form>

</body>
</html>


web.xml -



<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>FirstSpringMVCApplication02</display-name>

<servlet>
<servlet-name>spring-dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>


AdmisssionSuccess.jsp -



<html>
<body>

<h1>$headermessage</h1>

<h2>Congrats!! The Engineering college has processed the
application Successfully</h2>

<h3>Details submitted by you are: :</h3>

<table>

<tr>
<td>Student_FirstName : </td>
<td>$student1.firstName</td>
</tr>

<tr>
<td>Student_LastName : </td>
<td>$student1.lastName</td>
</tr>

<tr>
<td>Students_Hobby : </td>
<td>$student1.studentHobby</td>
</tr>

<tr>
<td>Student's_MobileNumber : </td>
<td>$student1.mobileNumber</td>
</tr>

<tr>
<td>Student's_DOB : </td>
<td>$student1.newDate</td>
</tr>

<tr>
<td>Student's_skills : </td>
<td>$student1.studentSkills</td>
</tr>

<tr>
<td>Student's Address : </td>
<td>country : $student1.studentAddress.country
city : $student1.studentAddress.city
street : $student1.studentAddress.street
pincode : $student1.studentAddress.pinCode</td>
</tr>


</table>


</body>
</html>









share|improve this question
























  • That stacktrace looks truncated. It is missing the "Caused by" that has the actual exception that was thrown.

    – Andreas
    Mar 7 at 18:40















0















I am creating a sample website for College last time when i ran the code it was running fine but when i ran it after some time I got this Error
"HTTP Status 500 - Servlet.init() for servlet spring-dispatcher threw exception"



Error Messages -




type Exception report



message Servlet.init() for servlet spring-dispatcher threw exception



description The server encountered an internal error that prevented it
from fulfilling this request.



exception



javax.servlet.ServletException: Servlet.init() for servlet
spring-dispatcher threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)



java.lang.Thread.run(Thread.java:748)




Following are the classes which i am working on



spring-dispatcher-servlet.xml -



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">


<context:component-scan base-package="com.newseries.hecontroller" />
<mvc:annotation-driven/>

<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>

</beans>


studentAdmissionController -



package com.newseries.hecontroller;



import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Map;
import java.text.DateFormat;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class studentAdmissionController

@InitBinder
public void initBinder(WebDataBinder binder)
//binder.setDisallowedFields(new String[] "mobileNumber");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy****MM**dd");
binder.registerCustomEditor(Date.class, "newDate", new CustomDateEditor(sdf, false));
//binder.registerCustomEditor(String.class, "firstName", new StudentNameEditor());


@RequestMapping(value="/admissionForm.html", method = RequestMethod.GET)
public ModelAndView getAdmissionForm()
ModelAndView model = new ModelAndView("AdmissionForm");
return model;


@ModelAttribute
public void addcommonmethod(Model model)
model.addAttribute("headermessage", "SIT college of Engineering India");


@RequestMapping(value="/submitAdmissionForm.html", method = RequestMethod.POST)
public ModelAndView submitAdmissionForm(@ModelAttribute("student1") Student student1, BindingResult result)

if(result.hasErrors())
ModelAndView model1 = new ModelAndView("AdmissionForm");
return model1;


ModelAndView model = new ModelAndView("AdmissionSuccess");
return model;




AdmissionForm.jsp -



<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<body>
<h1>$headermessage</h1>
<h2>College Admission Courses</h2>

<form:errors path="student1.*"/>

<form action="/FirstSpringMVCApplication02/submitAdmissionForm.html"
method="post">
<table>
<tr> <td>Student's FirstName : </td> <td> <input type="text" name="firstName" /> </td> </tr>
<tr> <td>Student's LastName : </td> <td> <input type="text" name="lastName" /> </td> </tr>
<tr> <td>Student's Hobby : </td> <td> <input type="text" name="studentHobby" /> </td> </tr>
<tr> <td>Student's MobileNumber : </td> <td> <input type="text" name="mobileNumber" /> </td> </tr>
<tr> <td>Student DOB : </td> <td> <input type="text" name="newDate" /> </td> </tr>
<tr> <td>Student skillSet : </td> <td> <select name="studentSkills" multiple>
<option value="CoreJava">Core Java</option>
<option value="SpringMVC">SpringMVC</option>
<option value="SpringIOC">SpringIOC</option>
<option value="SpringAOP">SpringAOP</option>
<option value="SpringDAO">SpringDAO</option>
<option value="SpringBoot">SpringBoot</option>
<option value="Multithreading">Multithreading</option>
<option value="Collection">Collection</option>
<option value="Oops">Oops</option>
<option value="Hibernate">Hibernate</option>
</select></td> </tr>
</table>
<table>
<tr>
<td>Student's Address :</td>
</tr>

<tr>
<td>Country: <input type="text" name="studentAddress.country" /></td>
<td>City : <input type="text" name="studentAddress.city" /></td>
<td>Street : <input type="text" name="studentAddress.city" /></td>
<td>pinCode: <input type="text" name="studentAddress.pinCode" /></td>
</tr>

</table>

<input type="submit" value="Submit" />
</form>

</body>
</html>


web.xml -



<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>FirstSpringMVCApplication02</display-name>

<servlet>
<servlet-name>spring-dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>


AdmisssionSuccess.jsp -



<html>
<body>

<h1>$headermessage</h1>

<h2>Congrats!! The Engineering college has processed the
application Successfully</h2>

<h3>Details submitted by you are: :</h3>

<table>

<tr>
<td>Student_FirstName : </td>
<td>$student1.firstName</td>
</tr>

<tr>
<td>Student_LastName : </td>
<td>$student1.lastName</td>
</tr>

<tr>
<td>Students_Hobby : </td>
<td>$student1.studentHobby</td>
</tr>

<tr>
<td>Student's_MobileNumber : </td>
<td>$student1.mobileNumber</td>
</tr>

<tr>
<td>Student's_DOB : </td>
<td>$student1.newDate</td>
</tr>

<tr>
<td>Student's_skills : </td>
<td>$student1.studentSkills</td>
</tr>

<tr>
<td>Student's Address : </td>
<td>country : $student1.studentAddress.country
city : $student1.studentAddress.city
street : $student1.studentAddress.street
pincode : $student1.studentAddress.pinCode</td>
</tr>


</table>


</body>
</html>









share|improve this question
























  • That stacktrace looks truncated. It is missing the "Caused by" that has the actual exception that was thrown.

    – Andreas
    Mar 7 at 18:40













0












0








0








I am creating a sample website for College last time when i ran the code it was running fine but when i ran it after some time I got this Error
"HTTP Status 500 - Servlet.init() for servlet spring-dispatcher threw exception"



Error Messages -




type Exception report



message Servlet.init() for servlet spring-dispatcher threw exception



description The server encountered an internal error that prevented it
from fulfilling this request.



exception



javax.servlet.ServletException: Servlet.init() for servlet
spring-dispatcher threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)



java.lang.Thread.run(Thread.java:748)




Following are the classes which i am working on



spring-dispatcher-servlet.xml -



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">


<context:component-scan base-package="com.newseries.hecontroller" />
<mvc:annotation-driven/>

<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>

</beans>


studentAdmissionController -



package com.newseries.hecontroller;



import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Map;
import java.text.DateFormat;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class studentAdmissionController

@InitBinder
public void initBinder(WebDataBinder binder)
//binder.setDisallowedFields(new String[] "mobileNumber");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy****MM**dd");
binder.registerCustomEditor(Date.class, "newDate", new CustomDateEditor(sdf, false));
//binder.registerCustomEditor(String.class, "firstName", new StudentNameEditor());


@RequestMapping(value="/admissionForm.html", method = RequestMethod.GET)
public ModelAndView getAdmissionForm()
ModelAndView model = new ModelAndView("AdmissionForm");
return model;


@ModelAttribute
public void addcommonmethod(Model model)
model.addAttribute("headermessage", "SIT college of Engineering India");


@RequestMapping(value="/submitAdmissionForm.html", method = RequestMethod.POST)
public ModelAndView submitAdmissionForm(@ModelAttribute("student1") Student student1, BindingResult result)

if(result.hasErrors())
ModelAndView model1 = new ModelAndView("AdmissionForm");
return model1;


ModelAndView model = new ModelAndView("AdmissionSuccess");
return model;




AdmissionForm.jsp -



<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<body>
<h1>$headermessage</h1>
<h2>College Admission Courses</h2>

<form:errors path="student1.*"/>

<form action="/FirstSpringMVCApplication02/submitAdmissionForm.html"
method="post">
<table>
<tr> <td>Student's FirstName : </td> <td> <input type="text" name="firstName" /> </td> </tr>
<tr> <td>Student's LastName : </td> <td> <input type="text" name="lastName" /> </td> </tr>
<tr> <td>Student's Hobby : </td> <td> <input type="text" name="studentHobby" /> </td> </tr>
<tr> <td>Student's MobileNumber : </td> <td> <input type="text" name="mobileNumber" /> </td> </tr>
<tr> <td>Student DOB : </td> <td> <input type="text" name="newDate" /> </td> </tr>
<tr> <td>Student skillSet : </td> <td> <select name="studentSkills" multiple>
<option value="CoreJava">Core Java</option>
<option value="SpringMVC">SpringMVC</option>
<option value="SpringIOC">SpringIOC</option>
<option value="SpringAOP">SpringAOP</option>
<option value="SpringDAO">SpringDAO</option>
<option value="SpringBoot">SpringBoot</option>
<option value="Multithreading">Multithreading</option>
<option value="Collection">Collection</option>
<option value="Oops">Oops</option>
<option value="Hibernate">Hibernate</option>
</select></td> </tr>
</table>
<table>
<tr>
<td>Student's Address :</td>
</tr>

<tr>
<td>Country: <input type="text" name="studentAddress.country" /></td>
<td>City : <input type="text" name="studentAddress.city" /></td>
<td>Street : <input type="text" name="studentAddress.city" /></td>
<td>pinCode: <input type="text" name="studentAddress.pinCode" /></td>
</tr>

</table>

<input type="submit" value="Submit" />
</form>

</body>
</html>


web.xml -



<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>FirstSpringMVCApplication02</display-name>

<servlet>
<servlet-name>spring-dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>


AdmisssionSuccess.jsp -



<html>
<body>

<h1>$headermessage</h1>

<h2>Congrats!! The Engineering college has processed the
application Successfully</h2>

<h3>Details submitted by you are: :</h3>

<table>

<tr>
<td>Student_FirstName : </td>
<td>$student1.firstName</td>
</tr>

<tr>
<td>Student_LastName : </td>
<td>$student1.lastName</td>
</tr>

<tr>
<td>Students_Hobby : </td>
<td>$student1.studentHobby</td>
</tr>

<tr>
<td>Student's_MobileNumber : </td>
<td>$student1.mobileNumber</td>
</tr>

<tr>
<td>Student's_DOB : </td>
<td>$student1.newDate</td>
</tr>

<tr>
<td>Student's_skills : </td>
<td>$student1.studentSkills</td>
</tr>

<tr>
<td>Student's Address : </td>
<td>country : $student1.studentAddress.country
city : $student1.studentAddress.city
street : $student1.studentAddress.street
pincode : $student1.studentAddress.pinCode</td>
</tr>


</table>


</body>
</html>









share|improve this question
















I am creating a sample website for College last time when i ran the code it was running fine but when i ran it after some time I got this Error
"HTTP Status 500 - Servlet.init() for servlet spring-dispatcher threw exception"



Error Messages -




type Exception report



message Servlet.init() for servlet spring-dispatcher threw exception



description The server encountered an internal error that prevented it
from fulfilling this request.



exception



javax.servlet.ServletException: Servlet.init() for servlet
spring-dispatcher threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)



java.lang.Thread.run(Thread.java:748)




Following are the classes which i am working on



spring-dispatcher-servlet.xml -



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">


<context:component-scan base-package="com.newseries.hecontroller" />
<mvc:annotation-driven/>

<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>

</beans>


studentAdmissionController -



package com.newseries.hecontroller;



import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Map;
import java.text.DateFormat;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class studentAdmissionController

@InitBinder
public void initBinder(WebDataBinder binder)
//binder.setDisallowedFields(new String[] "mobileNumber");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy****MM**dd");
binder.registerCustomEditor(Date.class, "newDate", new CustomDateEditor(sdf, false));
//binder.registerCustomEditor(String.class, "firstName", new StudentNameEditor());


@RequestMapping(value="/admissionForm.html", method = RequestMethod.GET)
public ModelAndView getAdmissionForm()
ModelAndView model = new ModelAndView("AdmissionForm");
return model;


@ModelAttribute
public void addcommonmethod(Model model)
model.addAttribute("headermessage", "SIT college of Engineering India");


@RequestMapping(value="/submitAdmissionForm.html", method = RequestMethod.POST)
public ModelAndView submitAdmissionForm(@ModelAttribute("student1") Student student1, BindingResult result)

if(result.hasErrors())
ModelAndView model1 = new ModelAndView("AdmissionForm");
return model1;


ModelAndView model = new ModelAndView("AdmissionSuccess");
return model;




AdmissionForm.jsp -



<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<body>
<h1>$headermessage</h1>
<h2>College Admission Courses</h2>

<form:errors path="student1.*"/>

<form action="/FirstSpringMVCApplication02/submitAdmissionForm.html"
method="post">
<table>
<tr> <td>Student's FirstName : </td> <td> <input type="text" name="firstName" /> </td> </tr>
<tr> <td>Student's LastName : </td> <td> <input type="text" name="lastName" /> </td> </tr>
<tr> <td>Student's Hobby : </td> <td> <input type="text" name="studentHobby" /> </td> </tr>
<tr> <td>Student's MobileNumber : </td> <td> <input type="text" name="mobileNumber" /> </td> </tr>
<tr> <td>Student DOB : </td> <td> <input type="text" name="newDate" /> </td> </tr>
<tr> <td>Student skillSet : </td> <td> <select name="studentSkills" multiple>
<option value="CoreJava">Core Java</option>
<option value="SpringMVC">SpringMVC</option>
<option value="SpringIOC">SpringIOC</option>
<option value="SpringAOP">SpringAOP</option>
<option value="SpringDAO">SpringDAO</option>
<option value="SpringBoot">SpringBoot</option>
<option value="Multithreading">Multithreading</option>
<option value="Collection">Collection</option>
<option value="Oops">Oops</option>
<option value="Hibernate">Hibernate</option>
</select></td> </tr>
</table>
<table>
<tr>
<td>Student's Address :</td>
</tr>

<tr>
<td>Country: <input type="text" name="studentAddress.country" /></td>
<td>City : <input type="text" name="studentAddress.city" /></td>
<td>Street : <input type="text" name="studentAddress.city" /></td>
<td>pinCode: <input type="text" name="studentAddress.pinCode" /></td>
</tr>

</table>

<input type="submit" value="Submit" />
</form>

</body>
</html>


web.xml -



<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>FirstSpringMVCApplication02</display-name>

<servlet>
<servlet-name>spring-dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>


AdmisssionSuccess.jsp -



<html>
<body>

<h1>$headermessage</h1>

<h2>Congrats!! The Engineering college has processed the
application Successfully</h2>

<h3>Details submitted by you are: :</h3>

<table>

<tr>
<td>Student_FirstName : </td>
<td>$student1.firstName</td>
</tr>

<tr>
<td>Student_LastName : </td>
<td>$student1.lastName</td>
</tr>

<tr>
<td>Students_Hobby : </td>
<td>$student1.studentHobby</td>
</tr>

<tr>
<td>Student's_MobileNumber : </td>
<td>$student1.mobileNumber</td>
</tr>

<tr>
<td>Student's_DOB : </td>
<td>$student1.newDate</td>
</tr>

<tr>
<td>Student's_skills : </td>
<td>$student1.studentSkills</td>
</tr>

<tr>
<td>Student's Address : </td>
<td>country : $student1.studentAddress.country
city : $student1.studentAddress.city
street : $student1.studentAddress.street
pincode : $student1.studentAddress.pinCode</td>
</tr>


</table>


</body>
</html>






java html spring spring-mvc servlets






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 18:31









Sterling Archer

16.1k126191




16.1k126191










asked Mar 7 at 18:26









iAniket001iAniket001

11




11












  • That stacktrace looks truncated. It is missing the "Caused by" that has the actual exception that was thrown.

    – Andreas
    Mar 7 at 18:40

















  • That stacktrace looks truncated. It is missing the "Caused by" that has the actual exception that was thrown.

    – Andreas
    Mar 7 at 18:40
















That stacktrace looks truncated. It is missing the "Caused by" that has the actual exception that was thrown.

– Andreas
Mar 7 at 18:40





That stacktrace looks truncated. It is missing the "Caused by" that has the actual exception that was thrown.

– Andreas
Mar 7 at 18:40












1 Answer
1






active

oldest

votes


















0














add this param into web.xml file



<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-dispatcher-servlet.xml</param-value>
</context-param>





share|improve this answer























  • Thanks for your answer Rathnayake, The issue is solved it was related to server. I have changed the tomcat server from version 7 to 8.

    – iAniket001
    Mar 18 at 15:52











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55050509%2fhttp-status-500-servlet-init-for-servlet-spring-dispatcher-threw-exception%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














add this param into web.xml file



<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-dispatcher-servlet.xml</param-value>
</context-param>





share|improve this answer























  • Thanks for your answer Rathnayake, The issue is solved it was related to server. I have changed the tomcat server from version 7 to 8.

    – iAniket001
    Mar 18 at 15:52















0














add this param into web.xml file



<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-dispatcher-servlet.xml</param-value>
</context-param>





share|improve this answer























  • Thanks for your answer Rathnayake, The issue is solved it was related to server. I have changed the tomcat server from version 7 to 8.

    – iAniket001
    Mar 18 at 15:52













0












0








0







add this param into web.xml file



<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-dispatcher-servlet.xml</param-value>
</context-param>





share|improve this answer













add this param into web.xml file



<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-dispatcher-servlet.xml</param-value>
</context-param>






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 7 at 19:10









RathnayakeRathnayake

3461416




3461416












  • Thanks for your answer Rathnayake, The issue is solved it was related to server. I have changed the tomcat server from version 7 to 8.

    – iAniket001
    Mar 18 at 15:52

















  • Thanks for your answer Rathnayake, The issue is solved it was related to server. I have changed the tomcat server from version 7 to 8.

    – iAniket001
    Mar 18 at 15:52
















Thanks for your answer Rathnayake, The issue is solved it was related to server. I have changed the tomcat server from version 7 to 8.

– iAniket001
Mar 18 at 15:52





Thanks for your answer Rathnayake, The issue is solved it was related to server. I have changed the tomcat server from version 7 to 8.

– iAniket001
Mar 18 at 15:52



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55050509%2fhttp-status-500-servlet-init-for-servlet-spring-dispatcher-threw-exception%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved