I created just a dynamic web project in Eclipse and when I run the the helloworld webapp then I see the index.html page with no problems screenshot:
But when I go to the /HelloServlet
path then I'm getting a 404 error screenshot:
However when I go to localhost:8080 then I can see that Tomcat is running screenshot:
In the logs I can also read that the server is running screenshot:
Here are my server properties screenshot:
And here is the code of HelloServlet.java:
@WebServlet("/HelloServlet")
public class HelloServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* Default constructor.
*/
public HelloServlet() {
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
Anyone has a clue how to fix this? At my work I had installed and configured Eclipse with Tomcat with no problems. But somehow I can't manage to get it working at home.