java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid (I) Z

Ich versuche, mein Servlet mithilfe der Datenquelle mit der MySQL-Datenbank zu verbinden. Aber wenn ich mein Servlet starte, bekomme ich diese Ausnahme:

java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid(I)Z
    org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:913)
    org.apache.tomcat.dbcp.dbcp2.PoolableConnection.validate(PoolableConnection.java:282)
    org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:356)
    org.apache.tomcat.dbcp.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2306)
    org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2289)
    org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2038)
    org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1532)
    Servlet.AbdulTayyebs.processRequest(AbdulTayyebs.java:36)
    Servlet.AbdulTayyebs.doGet(AbdulTayyebs.java:57)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Hier ist meine Content.xml

<Resource name="jdbc/abdultayyebs" auth="Container"
          type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver"
          url="jdbc:mysql://127.0.0.1:4000/abdultayyebs?zeroDateTimeBehavior=convertToNull"
          username="root" password="february1996" maxActive="5" maxIdle="2"
          maxWait="1000"/>

Hier ist meine web.xml

  <resource-ref>
  <description>DB Connection</description>
  <res-ref-name>jdbc/abdultayyebs</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth></resource-ref>

nd hier ist mein Servlet AbdulTayye

 import java.io.IOException;
 import java.io.PrintWriter; 
 import java.sql.Connection;
 import java.sql.SQLException;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.sql.DataSource;

 public class AbdulTayyebs extends HttpServlet {

  DataSource ds=null;  

 @Override
 public void init(ServletConfig config)throws ServletException{
    try {
     Context initContext = new InitialContext();
     Context envContext  = (Context)initContext.lookup("java:/comp/env");
     ds = (DataSource)envContext.lookup("jdbc/abdultayyebs");  
    } catch (Exception e) {
     throw new ServletException("Something went wrong while Initializing the Servlet",e);
    }
  }

    protected void processRequest(HttpServletRequest request,                   
       HttpServletResponse response)
       throws ServletException,IOException {
       PrintWriter write = response.getWriter();
       try {   
       Others.Action a = Others.ActionFactory.CreateAction(request);
     try(Connection c=ds.getConnection()){
     String page = a.Execute(c,request,request.getSession(false));
       request.getRequestDispatcher(page).forward(request, response); 
      }      
   }     
   catch (SQLException e) {
     write.println(e);
   }
   catch (ServletException e) {
     write.println(e);     
   }
   catch (Exception e) {       
    write.println(e);
   }   
 }

 @Override
 protected void doGet(HttpServletRequest request, HttpServletResponse  response)
        throws ServletException, IOException {
      processRequest(request, response);
   }

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
     processRequest(request, response);
     } 
   }

Ich habe auch den mysql jdbc-Treiber im lib-Ordner von tomcat hinzugefügt, aber auch das hat nicht geholfen? Es wäre sehr dankbar, wenn mir jemand helfen könnte

Antworten auf die Frage(8)

Ihre Antwort auf die Frage