Search code examples
javaeclipsejakarta-eeservletsjava-ee-7

Unable to add Servlet in eclipse


I am setting up a simple server project in eclipse (using a Glassfish as a server if it's relevant). I cannot seem to add a Servlet though. Unlike another question I've seen where a project cannot be selected I can select the project, but the finish or next buttons remain disabled. I tried manually creating a class that extends HttpServlet ahead of time and selecting but it the finish and next buttons are still disabled:

Custom 'WebService' servlet is selected but finish is disabled

I am running Eclipse 4.3, and I have tried starting it with -clean. Beyond that I'm not sure what to try.

EDIT:

As I said I orginally tried to create a new class using the dialog and only when that did not work did I create my WebService class. Here is what I orignally tried (using NewWebService as the name since WebService now already exists)

I cannot create new new class either


Solution

  • @Fr33dan: Check if dynamic web Module is checked in in your project facets.Also is this a maven project?


    In the screen shot you provided it seems like you are checking the box Use an existing Servlet class or JSP. Just uncheck it and it should work fine, you will be able to create new class.