New
New

Reputation: 1

Exception Cannot load JDBC driver class 'com.mysql.cj.jdbc.Driver.class'

I'm trying to connect Context.xml file to my Demo.java(Servlet) on Eclipse. Cannot load JDBC driver class 'com.mysql.cj.jdbc.Driver'. Please let me know where I'm wrong. Please help. Demo.java(servlet) with console Context.xml file

mysql-connector jar is added wherever possible. still not able to resolve the exception

Upvotes: -1

Views: 445

Answers (1)

Ishan
Ishan

Reputation: 537

It seems your context.xml has com.mysql.cj.jdbc.Driver.class mentioned. You should not mention .class there. Just mention com.mysql.cj.jdbc.Driver. This is the fully qualified class name. If you add .class at the end, then Driver becomes the package, and it tries to search for a driver class by name class in the Driver package, which it won't find.

So,

driverClassName="com.mysql.cj.jdbc.Driver"

Upvotes: 0

Related Questions