Ashot Karakhanyan
Ashot Karakhanyan

Reputation: 2830

In application I have acsess to JDBC driver (exception java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver)

The same project servlet application does not work, but "hello world" method, in the same project, yes. Here the picture ofproject.

enter image description here

Versions:

Intellij IDEA - 2018.2

mySQL driver version: 8.0.11, driver com.mysql.cj.jdbc.Driver

servlet 9.0.81

In Code:

Class.forName(dbDriver).newInstance();
dbConnection = DriverManager.getConnection(connectionUrl, userName, password);

Exception:

java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver ...

BTW:

The same exception I receive also without mysql dependency in PON.xml

So, this is issue or I missing something. Thanks

UPDATE enter image description here

SOLVED: We need to add library in Artifact.

Upvotes: 0

Views: 337

Answers (1)

CrazyCoder
CrazyCoder

Reputation: 401975

Please make sure all the required jars are also included in the Artifact configuration that you are deploying on the application server.

Upvotes: 1

Related Questions