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
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
add a comment |
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
That stacktrace looks truncated. It is missing the "Caused by" that has the actual exception that was thrown.
– Andreas
Mar 7 at 18:40
add a comment |
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
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
java html spring spring-mvc servlets
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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>
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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>
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
add a comment |
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>
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
add a comment |
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>
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>
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
That stacktrace looks truncated. It is missing the "Caused by" that has the actual exception that was thrown.
– Andreas
Mar 7 at 18:40