I'm trying for a couple of hours now but nothing works need some help here!
I'm trying to run an javaEE webapplication on http://localhost:8080/hello-world
When I go to http://localhost:8080 I see that the server is running. But /hello-world is not found HTTP Status 404 - Not Found
.
Project structure:
Web.xml:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>MainServlet</servlet-name>
<servlet-class>controller.MainServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MainServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
MainServlet:
package controller;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet(urlPatterns="/hello-world")
public class MainServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("TESTTESTTEST");
request.getRequestDispatcher("/test.jsp").forward(request, response);
}
}
What am I doing wrong here? Why don't I see the log message: TESTTESTTEST
in the console and why is /test.jsp
not returned?
Please help me out.
--EDIT
Server configuration: