java.lang.ExceptionInInitializerErrorattop.simba1949.dao.SaveProduct.save(SaveProduct.java:14) atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod) atsun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource) atsun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource) atjava.lang.reflect.Method.invoke(UnknownSource) atorg.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) atorg.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) atorg.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) atorg.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) atorg.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) atorg.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) atorg.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) atorg.junit.runners.ParentRunner$3.run(ParentRunner.java:290) atorg.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) atorg.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) atorg.junit.runners.ParentRunner.access$000(ParentRunner.java:58) atorg.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) atorg.junit.runners.ParentRunner.run(ParentRunner.java:363) atorg.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) atorg.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) atorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) atorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) atorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) atorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Causedby: org.hibernate.service.spi.ServiceException: Unabletocreaterequestedservice [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] atorg.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:244) atorg.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:208) atorg.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189) atorg.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51) atorg.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94) atorg.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:217) atorg.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189) atorg.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352) atorg.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111) atorg.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) atorg.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418) atorg.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87) atorg.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:692) atorg.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724) attop.simba1949.util.SessionManagerUtils.<clinit>(SessionManagerUtils.java:14) ... 24moreCausedby: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: HHH010003: JDBCDriverclassnotfound: com.mysql.jdbc.Driveratorg.hibernate.c3p0.internal.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:131) atorg.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94) atorg.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:217) atorg.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189) atorg.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145) atorg.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66) atorg.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) atorg.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88) atorg.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:234) ... 38moreCausedby: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unabletoloadclass [com.mysql.jdbc.Driver] atorg.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:229) atorg.hibernate.c3p0.internal.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:128) ... 46moreCausedby: java.lang.ClassNotFoundException: Couldnotloadrequestedclass : com.mysql.jdbc.Driveratorg.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:217) atjava.lang.ClassLoader.loadClass(UnknownSource) atjava.lang.ClassLoader.loadClass(UnknownSource) atjava.lang.Class.forName0(NativeMethod) atjava.lang.Class.forName(UnknownSource) atorg.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:226) ... 47more
解决方案:hibernate不能够创建数据库,查看数据库是否存在