Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HTTP Status 500 - Servlet execution threw an exception. I am getting this error while calling a java class in servlet. Here is the error.

HTTP Status 500 - Servlet execution threw an exception. I am getting this error while calling a java class in servlet.

Here is the error.

Type Exception Report

Message Servlet execution threw an exception

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Servlet execution threw an exception org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 

Root Cause

java.lang.StackOverflowError java.base/java.util.Properties.hashCode(Properties.java:1436) java.base/java.util.concurrent.ConcurrentHashMap.hashCode(ConcurrentHashMap.java:1302) java.base/java.util.Properties.hashCode(Properties.java:1436) java.base/java.util.concurrent.ConcurrentHashMap.hashCode(ConcurrentHashMap.java:1302) java.base/java.util.Properties.hashCode(Properties.java:1436) java.base/java.util.concurrent.ConcurrentHashMap.hashCode(ConcurrentHashMap.java:1302) java.base/java.util.Properties.hashCode(Properties.java:1436) java.base/java.util.concurrent.ConcurrentHashMap.hashCode(ConcurrentHashMap.java:1302) java.base/java.util.Properties.hashCode(Properties.java:1436) java.base/java.util.concurrent.ConcurrentHashMap.hashCode(ConcurrentHashMap.java:1302) java.base/java.util.Properties.hashCode(Properties.java:1436) java.base/java.util.concurrent.ConcurrentHashMap.hashCode(ConcurrentHashMap.java:1302) java.base/java.util.Properties.hashCode(Properties.java:1436) java.base/java.util.concurrent.ConcurrentHashMap.hashCode(ConcurrentHashMap.java:1302) java.base/java.util.Properties.hashCode(Properties.java:1436) java.base/java.util.concurrent.ConcurrentHashMap.hashCode(ConcurrentHashMap.java:1302) java.base/java.util.Properties.hashCode(Properties.java:1436) java.base/java.util.concurrent.ConcurrentHashMap.hashCode(ConcurrentHashMap.java:1302) java.base/java.util.Properties.hashCode(Properties.java:1436) java.base/java.util.concurrent.ConcurrentHashMap.hashCode(ConcurrentHashMap.java:1302) java.base/java.util.Properties.hashCode(Properties.java:1436)

Here is a code of my java class

@WebServlet("/register")

public class Customers extends HttpServlet{

private static final long serialVersionUID = 1L;

CustomerInfo customerInfo;

public void init() {

customerInfo = new CustomerInfo();

}

public Customers() {

super();

}

//get info from the user

protected void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

response.getWriter().append("Served at: ")

.append(request.getContextPath());

RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/register.jsp");

dispatcher.forward(request, response);

}

protected void doPost(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

String firstName = request.getParameter("firstName");

String lastName = request.getParameter("lastName");

String phoneNumber = request.getParameter("phoneNumber");

CustomerPOJO customerPOJO = new CustomerPOJO();

customerPOJO.setFirstName(firstName);

customerPOJO.setLastName(lastName);

customerPOJO.setPhoneNumber(phoneNumber);

try {

//send email

customerInfo.registerEmployee(customerPOJO);

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/details.jsp");

dispatcher.forward(request, response);

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions