Java Errors and Solutions

Errors

Solutions

javax.servlet.annotation cannot be resolved

(or)

webservlet cannot be resolved to a type

(or)

httpservlet cannot be resolved to a type

Add servlet-api-3.0.jar in to the libraries
Server Tomcat v7.0 Server at localhost failed to start

(Or)

port update not being taking place” issues

1. Open the Servers Tab from Windows>Show View>Servers menu

  1. Right click on the server and delete it
  2. Create a new server by going New>Server on Server Tab
  3. Click on “Configure runtime environments…” link
  4. Select the Apache Tomcat v7.0 server and remove it. This will remove the Tomcat server configuration. This is where many people do mistake – they remove the server but do not remove the Runtime environment.
  5. Click on OK and exit the screen above now.
  6. From the screen below, choose Apache Tomcat v7.0 server and click on next button:
  7. Browse to Tomcat Installation Directory
  8. Click on Next and choose which project you would like to deploy:
  9. Click on Finish after Adding your project
  10. Now launch your server. This will fix your Server timeout or any issues with old server configuration.
HTTP Status 500 – Error instantiating servlet class Check the Servlet-class tag and url-pattern names.
Port already in use. Means already a tomcat instance is running in that port.

To kill that, goto task manager , find java.exe and kill it.

Sometimes when we close eclipse abruptly, tomcat might be running at the background.

HTTP Status 405 – HTTP method GET is not supported by this URL Servlet might have doPost method. Check the doGet and doPost
HTTP Status 404 – The requested resource is not available Check whether the action name and the servlet name are same or not. also you might have get this error when you configure the servlet mapping by web.xml and @WebServlet annotion. in this case remove any one mapping.
Java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory download commons-logging-1.1.2.jar file from apache site (https://commons.apache.org/proper/commons-logging/download_logging.cgi) and then add the jar file in to the library.