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
It seems your
context.xmlhascom.mysql.cj.jdbc.Driver.classmentioned. You should not mention.classthere. Just mentioncom.mysql.cj.jdbc.Driver. This is the fully qualified class name. If you add.classat the end, thenDriverbecomes the package, and it tries to search for a driver class by nameclassin theDriverpackage, which it won't find.So,