Problem with ClassNotFoundException JSP Java

0

I have the following class:

public class Metodo implements Mproceso{

@Override
public ArrayList mostrar() {

    Connection con;
    Statement st;
    ResultSet rs;
    ArrayList<Object> list = new ArrayList<>();
    try {
        Class.forName("com.mysql.jdbc.Driver");
        con = DriverManager.getConnection("jdbc:mysql://localhost:3306/runner","root","");
        String q = "SELECT * FROM productos";
        st = con.createStatement();
        rs = st.executeQuery(q);
        while (rs.next()){
            for (int x = 0;x<st.getMaxFieldSize();x++){
                for (int y = 0;y<st.getMaxRows();y++){
                    list.add(x,rs.getObject(y));
                }
            }
        }
    } catch (ClassNotFoundException | SQLException e) {
        e.printStackTrace();
    }
    return list;
}

}

And the next JSP:

<%@ page import="Model.Metodo" %>
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Titulo</title>
</head>
<body>
<%
 Metodo m = new Metodo();
 ArrayList list = m.mostrar();
 for (Object a: list){
 %>
 <h1><%=a%></h1>
 <%
 }
%>
</body>

Where I call a method called show (), which is declared in the class above. The problem here is that when it runs I get the error that it does not find the Driver (ClassNotFoundException) but I have the mysql connector in all possible places:

Note: I am using Intellij IDE.

    
asked by Francisco Castle 07.04.2018 в 16:50
source

0 answers