Я создаю пример веб-сайта для College в последний раз, когда я запускал код, он работал нормально, но когда я запускал его через какое-то время, я получал эту ошибку "HTTP Status 500 - Servlet.init () для сервлета бросил пружину-диспетчерисключение "
Сообщения об ошибках -
тип Сообщение об исключении
сообщение Servlet.init () для броска сервлета пружина-диспетчер исключение
описаниеСервер обнаружил внутреннюю ошибку, которая не позволила ему выполнить этот запрос.
исключение
javax.servlet.ServletException: Servlet.init () для сервлета-пружины-диспетчер вызвал исключение org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:98) org.apache.catalina.valves.AccessLogValve.invoke (AccessLogVal50).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:til3).concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:617)
java.lang.Thread.run7: Thread.j
Ниже приведены классы, над которыми я работаю
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 -
пакет 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>