创建sessionFactory错误, init方法调用失败;嵌套异常是org.hibernate.exception。
未知原因:在maven中hibernate映射开启了自动更新表,出现此异常
org.springframework.beans.factory.beancreationexception: error creating bean with name 'sessionfactory' defined in class path resource [spring/applicationcontext-dao.xml]: invocation of init method failed; nested exception is org.hibernate.exception.sqlgrammarexception: error creating databaseinformation for schema migration
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1578)
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:545)
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:482)
at org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306)
at org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230)
at org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302)
at org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:197)
at org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:753)
at org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:839)
at org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:538)
at org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:139)
at org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:83)
at com.zsn.crm.dao.test.customertest.tt(customertest.java:12)
at sun.reflect.nativemethodaccessorimpl.invoke0(native method)
at sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62)
at sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)
at java.lang.reflect.method.invoke(method.java:498)
at org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:44)
at org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:15)
at org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:41)
at org.junit.internal.runners.statements.invokemethod.evaluate(invokemethod.java:20)
at org.junit.runners.parentrunner.runleaf(parentrunner.java:263)
at org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:69)
at org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:48)
at org.junit.runners.parentrunner$3.run(parentrunner.java:231)
at org.junit.runners.parentrunner$1.schedule(parentrunner.java:60)
at org.junit.runners.parentrunner.runchildren(parentrunner.java:229)
at org.junit.runners.parentrunner.access$000(parentrunner.java:50)
at org.junit.runners.parentrunner$2.evaluate(parentrunner.java:222)
at org.junit.runners.parentrunner.run(parentrunner.java:292)
at org.eclipse.jdt.internal.junit4.runner.junit4testreference.run(junit4testreference.java:89)
at org.eclipse.jdt.internal.junit.runner.testexecution.run(testexecution.java:41)
at org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:541)
at org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:763)
at org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:463)
at org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:209)
caused by: org.hibernate.exception.sqlgrammarexception: error creating databaseinformation for schema migration
at org.hibernate.exception.internal.sqlexceptiontypedelegate.convert(sqlexceptiontypedelegate.java:63)
at org.hibernate.exception.internal.standardsqlexceptionconverter.convert(standardsqlexceptionconverter.java:42)
at org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:109)
at org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:95)
at org.hibernate.tool.hbm2ddl.schemaupdate.execute(schemaupdate.java:127)
at org.hibernate.tool.hbm2ddl.schemaupdate.execute(schemaupdate.java:101)
at org.hibernate.internal.sessionfactoryimpl.<init>(sessionfactoryimpl.java:470)
at org.hibernate.boot.internal.sessionfactorybuilderimpl.build(sessionfactorybuilderimpl.java:444)
at org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:708)
at org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:724)
at org.springframework.orm.hibernate5.localsessionfactorybean.buildsessionfactory(localsessionfactorybean.java:416)
at org.springframework.orm.hibernate5.localsessionfactorybean.afterpropertiesset(localsessionfactorybean.java:401)
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1637)
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1574)
... 35 more
caused by: com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: table 'maven_crm.all_sequences' doesn't exist
at sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method)
at sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62)
at sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45)
at java.lang.reflect.constructor.newinstance(constructor.java:423)
at com.mysql.jdbc.util.handlenewinstance(util.java:425)
at com.mysql.jdbc.util.getinstance(util.java:408)
at com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:944)
at com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:3978)
at com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:3914)
at com.mysql.jdbc.mysqlio.sendcommand(mysqlio.java:2530)
at com.mysql.jdbc.mysqlio.sqlquerydirect(mysqlio.java:2683)
at com.mysql.jdbc.connectionimpl.execsql(connectionimpl.java:2491)
at com.mysql.jdbc.connectionimpl.execsql(connectionimpl.java:2449)
at com.mysql.jdbc.statementimpl.executequery(statementimpl.java:1381)
at com.mchange.v2.c3p0.impl.newproxystatement.executequery(newproxystatement.java:35)
at org.hibernate.tool.schema.extract.internal.sequenceinformationextractorlegacyimpl.extractmetadata(sequenceinformationextractorlegacyimpl.java:42)
at org.hibernate.tool.schema.extract.internal.databaseinformationimpl.initializesequences(databaseinformationimpl.java:64)
at org.hibernate.tool.schema.extract.internal.databaseinformationimpl.<init>(databaseinformationimpl.java:60)
at org.hibernate.tool.hbm2ddl.schemaupdate.execute(schemaupdate.java:123)
... 44 more
上一篇: 我认为是奥特曼
下一篇: 一个打喷嚏,灵魂都出窍了