Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded

Ads
 

Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded

Hi,

I my Hibernate application I am getting following error:

Dec 19, 2013 11:59:46 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Enitial SessionFactory creation failedorg.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded
Exception in thread "main" java.lang.ExceptionInInitializerError
    at net.roseindia.HibernateUtil.<clinit>(HibernateUtil.java:32)
    at net.roseindia.CreateData.main(CreateData.java:17)
Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded
    at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:111)
    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:76)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:160)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:132)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:223)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:89)
    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:76)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:160)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:132)
    at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1825)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1783)
    at net.roseindia.HibernateUtil.<clinit>(HibernateUtil.java:25)
    ... 1 more
Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [com.mysql.jdbc.Driver]
    at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:152)
    at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:106)
    ... 12 more
Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver
    at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:319)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:270)
    at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:149)
    ... 13 more

Let's know the solution.

Thanks

View Answers

December 19, 2013 at 11:59 AM

Hi,

Hibernate is not able to load the JDBC Driver for MySQL. Add the mysql-connector-java-5.1.27-bin.jar in your project.

Check Hibernate Tutorial section it contains huge number of examples of Hibernate.

Thanks

Ads









Related Tutorials/Questions & Answers:
Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded
Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded  Hi... failedorg.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded Exception in thread "main
Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded
Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded  Hi... failedorg.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded Exception in thread "main
Advertisements
Solving java.lang.ClassNotFoundException: com.mysql.jdbc.Driver exception
/ and you will find the link for downloading the JDBC Driver. ssing class and the JVM... have to download the JDBC driver of MySQL and then install. Here is the video.../connector/j/ and you will find the link for downloading the JDBC Driver. From
JDBC Driver - JDBC
JDBC Driver  What are the diffrent types of JDBC driver
Exception "Couldn't load database driver: com.mysql.jdbc.Driver". I
Exception "Couldn't load database driver: com.mysql.jdbc.Driver". I  I m trying to connect to mysql from netbeans 6.9 but i m getting this exception "Couldn't load database driver: com.mysql.jdbc.Driver". I ve added the connector
JDBC Driver
JDBC Driver  I want to know the clear syntax and usages of $ types of JDBC drivers. Where can i get it? I search for it, nobody give Syntax for tat different drivers. can u give a sample codes for tat
type 4 jdbc driver
type 4 jdbc driver   i read in this site that type 4 jdbc driver is the fastest one so used it to connect with the database.......but not tried another drivers,....can u specifically answer me why type 4 is the fastest one
jdbc type-4 driver
jdbc type-4 driver  I was tried the code that you give to run type-4 driver . import java.sql.*; import oracle.jdbc.driver.*; import oracle.sql.*; while compiling the error was like: package oracle.jdbc.odbc.driver does
maven mysql jdbc driver
maven mysql jdbc driver  How to add the maven mysql jdbc driver dependency in the pom.xml file of a maven based application?   Hi, Its simple!! Add the following into your pom.xml file: <dependency> <
How to download MySQL JDBC driver?
How to download MySQL JDBC driver?  Hi, What is JDBC Driver? How to download MySQL JDBC driver? Thanks   Hi, JDBC - Java database... program. To connect to MySQL database from Java program we need JDBC Driver of MySQL
java- jdbc with type 4 driver
and Register the JDBC driver:*** DriverManager.registerDriver(new...java- jdbc with type 4 driver  My program code is----- import... = DriverManager.getConnection("jdbc:oracle:[email protected]:1521:XE", "system", "oracle"); Statement
the specified dsn contains an architecture mismatch between the driver and application windows 7
the specified dsn contains an architecture mismatch between the driver and application windows 7  sir, i m using windows 7 64-bit , 32-bit java...--- the specified dsn contains an architecture mismatch between the driver
java.lang.classnotfoundexception com.mysql.jdbc.driver
comes in Java application when MySQL JDBC Driver is not available...; </dependency> This will download the dependency of MySQL JDBC Driver...java.lang.classnotfoundexception com.mysql.jdbc.driver  Hi, How
how to set fetch size for jdbc odbc driver
size for the JDBC ODBC driver and how can i fetch a set of results for JDBC ODBC driver?   Fetching results JDBC ODBC Driver A. The default fetch.... To fetch small number of rows from database, JDBC driver is designed so
Version of com.qwazr>jdbc-cache-driver dependency
List of Version of com.qwazr>jdbc-cache-driver dependency
Jdbc connectivity by type 4 driver
Jdbc connectivity by type 4 driver  I have done a code with database connectivity with driver 4,it copiles,but while running it is showing...=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521","system","123
JDBC Video Tutorial: How to download JDBC Driver for MySQL?
First thing to develop the JDBC program is to download the JDBC Driver... the MySQL database, so we have download the JDBC Driver for the MySQL. The website mysql.com is distributing the free version of the JDBC driver for the MySQL
JDBC Drive For Mysql
; jdbc driver for mysql is specified in string driver.  JdbcDriveForMysql... jdbc driver for mysql : com.mysql.jdbc.Driver Download code... declared a string driver initialized  with "com.mysql.jdbc.Driver"
MySQL JDBC Driver pom dependency code
MySQL JDBC Driver pom dependency code  Hi, What is the POM dependency code for MySQL's latest JDBC Driver? I can download the MySQL driver from mysql website but I need to use it in a application which is based on Maven 3
the JDBC Driver has been forcibly unregistered
the JDBC Driver has been forcibly unregistered  Hi my application... application was st opped. To prevent a memory leak, the JDBC Driver has been... the web application was stopped. To prevent a memory leak, the JDBC Driver has been
Maven Dependency jdbc-cache-driver >> 1.1
You should include the dependency code given in this page to add Maven Dependency of com.qwazr >> jdbc-cache-driver version1.1 in your project
Maven Dependency jdbc-cache-driver >> 1.0
You should include the dependency code given in this page to add Maven Dependency of com.qwazr >> jdbc-cache-driver version1.0 in your project
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver  private void... = Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/krishna","krishna","krishna"); Statement stmt
No suitable driver found for jdbc:mysql://localhost:3306/TEST
No suitable driver found for jdbc:mysql://localhost:3306/TEST  hii, I have wrietten web project using jsp and hibernate but its not working. ava.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/TEST
Exception: com.mysql.jdbc.Driver
Exception: com.mysql.jdbc.Driver  How to resolve Exception: com.mysql.jdbc.Driver in netbeans? Thanks in advance
Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4  Hi, In my Hibernate application following error is coming: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less
unable to retrive the data from mysql using servlet using jdbc driver
Connection con = null; String url = "jdbc:mysql://localhost:3306/"; String dbName = "rapax"; String driver = "com.mysql.jdbc.Driver"; String...unable to retrive the data from mysql using servlet using jdbc driver 
jdbc - JDBC
Loading JDBC driver at runtime  How to load JDBC Driver at runtime
Driver
Driver  can u send type4 jdbc driver class name and url for microsoft sql server 2008
jdbc
driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://localhost:3306/test...jdbc  i had written jdbc connection in method and i need to get...(driver); return DriverManager.getConnection(url, username, password
JDBC
= "jdbctutorial"; String driver = "com.mysql.jdbc.Driver"; try{ Class.forName(driver...JDBC save a data in the database  I need a code to save a data... between java and mysql using JDBC and saves the data into the database. import

Ads