I tried to add this servlet
package com.classmgt.servlet;
@WebServlet(\"/ControllerServlet\")
public class ControllerServlet extends HttpServlet {}
Caused by: java.lang.IllegalArgumentException: The servlets named [ControllerServlet] and [com.classmgt.servlet.ControllerServlet] are both mapped to the url-pattern [/ControllerServlet] which is not permitted
It seems that you have mixed @WebServlet
annotation based and web.xml
based configuration.
I doubt that you created a Servlet using the "Create Servlet" wizard which creates web.xml entry with url-pattern and then , added a @WebServlet
annotation which duplicates anything you may put in the web.xml.
You should use the one or the other, not both. Remove the mapping from web.xml
and go ahead with using only the @WebServlet
annotation.
Read more: Servlet 3.0 Annotations and our Servlets wiki page.