客户端驱动程序上的IntelliJ IDEA ClassNotFoundException

时间:2018-08-07 16:52:56

标签: java database intellij-idea derby

我的项目以intellij的想法运行,它与Java Web应用程序有关。我尝试运行apache derby数据库,但未成功。由于未正确检测到ClientDriver,因此我收到ClassNotFoundException。我在stackoverflow中找到了一些答案,但仍然无法使用。

正在连接

    public DBConnectionJDBC() {
    try {
        //filehandler = new FileHandler("Servicelog.txt");
        //logger.addHandler(filehandler);
        logger.setLevel(Level.FINEST);
        logger.info("FILEHANDLER CREATED");
        Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
        this.con = DriverManager.getConnection("jdbc:derby://localhost:1527/Projektarbeit", "projekt", "projekt");
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | SQLException ex) {
        logger.log(Level.SEVERE, "[DBCONNECTIONJDBC] CANT CREATE INSTANCE", ex);
        return;
    }
    logger.info("DATABASE CONNECTED -- NO ERRORS");
}

输出

java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at model.DBConnectionJDBC.<init>(DBConnectionJDBC.java:30)
at server.Server.<init>(Server.java:27)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:151)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1044)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:773)

设置

Library Setting

任何人都可以向我解释,该怎么办? 谢谢

0 个答案:

没有答案