Javatpoint Logo

Unable to load class [com.mysql.jdbc.Driver]

By: lokesh*** On: Tue Feb 10 13:30:58 IST 2015     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
**********************************************
"Initial SessionFactory creation failed.org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [com.mysql.jdbc.Driver]
Exception in thread "main" java.lang.ExceptionInInitializerError
at co.navya.StoreData.main(StoreData.java:43)
Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [com.mysql.jdbc.Driver]
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:243)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.loadDriverIfPossible(DriverManagerConnectionProviderImpl.java:200)
************************************************************

hello sir,
i trying to connect my program with hibernate in eclipse. but i got an error.
can you help me to solve this problem.
Up0Down

 
I hope you have added your MySQL Driver in Eclipse Build path.
If not download the JDBC Driver for MySQL (Connector/J)and add in the Build path and try to run the program again.

If the error still persists, it means your Java program is unable to load it during runtime.
I suggest the following:

1)Go to your project Properties -> Run/Debug Settings
2)Select your class file from the Launch Configuration (if not available add manually clicking New->Java Application and provide your Main Class)
3) Click Edit->Classpath and select JRE System Library
4) Add External JAR and select the appropriate MySQL connector Jar File (for e.g., mysql-connector-java-5.1.34-bin.jar)
5) Execute the program, I hope the issue should be fixed now :)

All the Best!!
Image Created0Down

By: [email protected] On: Sat Feb 14 15:04:10 IST 2015 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No