Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 获取无法创建类';的JDBC驱动程序';用于连接URL';jdbc:mysql://127.0.0.1:3306/config 在Netbeans中';_Java_Netbeans_Connection_Pool - Fatal编程技术网

Java 获取无法创建类';的JDBC驱动程序';用于连接URL';jdbc:mysql://127.0.0.1:3306/config 在Netbeans中';

Java 获取无法创建类';的JDBC驱动程序';用于连接URL';jdbc:mysql://127.0.0.1:3306/config 在Netbeans中';,java,netbeans,connection,pool,Java,Netbeans,Connection,Pool,我搜索过类似的问题,没有找到适合我的解决方案。我在Netbeans>servlet中运行以下命令: public Connection getConnection() { Connection result = null; BasicDataSource dataSource = getDataSource(); try { result = dataSource.getConnection(); } catch (SQLException ex)

我搜索过类似的问题,没有找到适合我的解决方案。我在Netbeans>servlet中运行以下命令:

public Connection getConnection()
{
    Connection result = null;
    BasicDataSource dataSource = getDataSource();
    try {
        result = dataSource.getConnection();
    } catch (SQLException ex) {
        Logger.getLogger(ConnectionPool.class.getName()).log(Level.SEVERE, null, ex);
    }
    catch (Throwable e)
    {
        e.printStackTrace();
    }
    return result;
}
在Java项目中执行时,它可以正常工作。然后我将此项目的jar作为库添加到Netbeans中的servlet项目中-它引发异常:

“java.sql.SQLException:无法为连接URL”JDBC:mysql://127.0.0.1:3306/config""


看起来这个“类”应该指向一个类名,但是我从哪里得到它呢?

修复了这个问题。必须将驱动程序放入glassfish/lib目录