title: WebServlet cannot be resolved to a type
body: <p><strong>I was able to make my app works again, following the advices of user2821894, but after trying to call a servlet tomcat 7 stopped working again!!
  If i try to delete the code where i call my servlet my web app doesent' work!!
  Once i have a problem with a servlet tomcat stops working.</strong></p>
  
  <p>I had problem launching my web project on eclipse.  I had problem with Tomcat 7.
  So i 'delete' tomcat 7 from eclipse and then i added it again (again tomcat 7).</p>
  
  <p>now i have no problem launching my web project, but i have problem on my servlet.
  For example i get error like </p>
  
  <pre><code> WebServlet cannot be resolved to a type
   The attribute value is undefined for the annotation type 
  </code></pre>
  
  <p>I added servlet-api 3.0.jar to my project but i still have these problems.</p>
  
  <p>This is the code of my servlet</p>
  
  <pre><code> package Jeans;
      import java.io.IOException;
      import java.io.InputStream;
      import java.sql.Connection;
      import java.sql.PreparedStatement;
      import java.sql.SQLException;
  
      import javax.servlet.ServletException;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      import javax.servlet.annotation.WebServlet;
  
      import com.sun.java.swing.plaf.windows.TMSchema.Part;
  
  
      import javax.servlet.http.Part;
  
  
  
      @WebServlet("/FileUploadDBServlet ")
  
    //// i got an error here//////////////////////////// 
      @MultipartConfig(maxFileSize = 16177215)  
  
      public class FileUploadDBServlet extends HttpServlet {
  
  
          private String dbURL = "db";
          private String dbUser = "dbuser";
          private String dbPass = "dbpassword";
          String messageMio = "da contorllare";  
          GestioneDB gestioneDB;
          boolean connessione;       
          Connection conn;
  
          protected void doPost(HttpServletRequest request,
                  HttpServletResponse response) throws ServletException, IOException {
  
  
  
  
           String giorno= request.getParameter("giorno");
           String mese= request.getParameter("mese");
           String anno= request.getParameter("anno");         
           String dataFormatoItaliano = giorno + "-" + mese + "-" + anno;     
  
            String titolo = request.getParameter("titolo");
            String titoletto = request.getParameter("titoletto");
            String testoMouse = request.getParameter("testoMouse");
            String link = request.getParameter("link");
            String data = dataFormatoItaliano;
            String testo = request.getParameter("testo");
  
  
  
  
            //// i got an error here////////////////////////////
            Part filePart = request.getPart("immaginePrincipale");  
  
  
  
  
  
  
   String didascaliaImmaginePrincipale = request.getParameter("didascaliaImmaginePrincipale");       
  
  
              InputStream immaginePrincipale = null; 
              if (filePart != null) {             
                  // obtains input stream of the upload file
                  immaginePrincipale = filePart.getInputStream();
              }
  
  
  
  
  
              String message = null;  
  
              try {
  
                    gestioneDB = new GestioneDB(); 
                    conn = gestioneDB.cn();  
  
  
  
                    gestioneDB.inserimentoNews(titolo, titoletto, testoMouse, link, testo, data, immaginePrincipale, didascaliaImmaginePrincipale);
  
  
  
                  String sql = "INSERT INTO allegati_news (allegato,didascalia,tipo,id_news,immagine) values (?,?,?,?,?)";
  
  
  
  
                  PreparedStatement statement = conn.prepareStatement(sql);
                  statement.setString(1, "firstName");
                  statement.setString(2, "lastName");
                  statement.setInt(3, 1);
                  statement.setInt(4,1);            
                  if (immaginePrincipale != null) {              
                      statement.setBlob(5, immaginePrincipale);             
                  }
  
  
  
  
                  int row = statement.executeUpdate();
                  if (row &gt; 0) {
                      message = "File salvato nel db";
                  }
              } catch (SQLException ex) {
                  message = "ERROR: " + ex.getMessage();
                  ex.printStackTrace();
              } finally {
                  if (conn != null) {
  
                      try {
                          conn.close();
                      } catch (SQLException ex) {
                          ex.printStackTrace();
                      }
                  }
  
                 request.setAttribute("Message", gestioneDB.getInserimentoNewMessaggio());
  
  
  
                 getServletContext().getRequestDispatcher("/Message.jsp").forward(request, response);
              }
          }
      }
  </code></pre>
  
  <p>This is my web.xml file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
    &lt;display-name&gt;Jeans2&lt;/display-name&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
    &lt;servlet&gt;
      &lt;description&gt;&lt;/description&gt;
      &lt;display-name&gt;prova&lt;/display-name&gt;
      &lt;servlet-name&gt;prova&lt;/servlet-name&gt;
      &lt;servlet-class&gt;Jeans.prova&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;prova&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/prova&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;servlet&gt;
  
      &lt;description&gt;&lt;/description&gt;
      &lt;display-name&gt;FileUploadDBServlet&lt;/display-name&gt;
      &lt;servlet-name&gt;FileUploadDBServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;Jeans.FileUploadDBServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;FileUploadDBServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/FileUploadDBServlet&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
     &lt;servlet&gt;
      &lt;description&gt;&lt;/description&gt;
      &lt;display-name&gt;BlobDisplay&lt;/display-name&gt;
      &lt;servlet-name&gt;BlobDisplay&lt;/servlet-name&gt;
      &lt;servlet-class&gt;Jeans.BlobDisplay&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;BlobDisplay&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/BlobDisplay&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
  
  &lt;/web-app&gt;
  </code></pre>