0

I am following a video on Youtube to create a simple HelloWorld servlet web dynamic project in eclipse, but it does not work as excepted. Here is my project: enter image description here

enter image description here

The server is tomcat7, the setting is enter image description here All of these are followed in a tutorial, however, when I run the servlet it I get this:enter image description here and it throws java.lang.ClassNotFoundException. enter image description here Someone please help...

user2716189
  • 63
  • 1
  • 6
  • did you add server-api.jar into your build/class path? – Kishore Kumar Korada Jul 02 '15 at 04:08
  • you mean servlet-api.jar?yes it is added under Apache tomcat – user2716189 Jul 02 '15 at 04:31
  • Do not add that yourself. You should only be getting the APIs to compile against from Tomcat itself. Are you able to change the Server Location to one that doesn't require modifying the Tomcat installation? What about if the project is named with something other than a number? – nitind Jul 02 '15 at 04:37
  • It is added automatically which is under Libraries Apache Tomcat 7.0. I tried the project with different names and content root, but none of them worked. What do you mean by change server location which doesnt require modifying the Tomcat installation? Thank you – user2716189 Jul 02 '15 at 04:42
  • what is the exact package of your HelloWorld.java class is in? and what is the name of your jsp file? this should be a web.xml mapping issue. – Nomesh DeSilva Jul 02 '15 at 04:52
  • the package is "lee" which is shown in the first package. The jsp is a dummy page called "NewFile.jsp" which contains a form with the action pointed to the servlet
    – user2716189 Jul 02 '15 at 05:01
  • will you please add servlet-api.jar manually and check. Because your problem seems somewhere somehow that jar is missing – Kishore Kumar Korada Jul 02 '15 at 06:21
  • I tried to clean and build the project and it worked after. Thanks for your help. – user2716189 Jul 02 '15 at 09:18

0 Answers0