当前位置:Gxlcms > 数据库问题 > org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver class not found

org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver class not found

时间:2021-07-01 10:21:17 帮助过:7人阅读

 1 org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver class not found
 2     at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:107)
 3     at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
 4     at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
 5     at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
 6     at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:223)
 7     at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:89)
 8     at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
 9     at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
10     at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
11     at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
12     at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2277)
13     at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2273)
14     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1742)
15     at com.hibtest.entity.TestUsers.testShemaExport(TestUsers.java:23)
16     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
18     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
19     at java.lang.reflect.Method.invoke(Method.java:597)
20     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
21     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
22     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
23     at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
24     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
25     at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
26     at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
27     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
28     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
29     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
30     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
31     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
32     at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
33     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
34     at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
35     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
36     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
37     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
38     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
39 Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [com.mysql.jdbc.Driver]
40     at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:141)
41     at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:104)
42     ... 36 more
43 Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver
44     at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl$1.findClass(ClassLoaderServiceImpl.java:99)
45     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
46     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
47     at java.lang.Class.forName0(Native Method)
48     at java.lang.Class.forName(Class.java:247)
49     at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:138)
50     ... 37 more

 

1, 我的jar包有:

    技术分享

 

2, 之前使用的数据库连接驱动包是:

    技术分享

 

3, 总结:

    总之遇到这种问题一般都是导入的数据库连接jar包存在问题导致的,可能版本或者其它什么原因。因此解决方案就是可以换其它版本的jar包试试。

 

 

    

 

org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver class not found

标签:

人气教程排行