i have project works fine in memory database h2 - tried mysql , following error.
org.springframework.beans.factory.beancreationexception: error creating bean name 'entitymanagerfactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/hibernatejpaautoconfiguration.class]: invocation of init method failed; nested exception javax.persistence.persistenceexception: [persistenceunit: default] unable build hibernate sessionfactory @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1578) ~[spring-beans-4.3.2.release.jar:4.3.2.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:545) ~[spring-beans-4.3.2.release.jar:4.3.2.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:482) ~[spring-beans-4.3.2.release.jar:4.3.2.release] @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306) ~[spring-beans-4.3.2.release.jar:4.3.2.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) ~[spring-beans-4.3.2.release.jar:4.3.2.release] @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302) ~[spring-beans-4.3.2.release.jar:4.3.2.release] @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:197) ~[spring-beans-4.3.2.release.jar:4.3.2.release] @ org.springframework.context.support.abstractapplicationcontext.getbean(abstractapplicationcontext.java:1076) ~[spring-context-4.3.2.release.jar:4.3.2.release] @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:851) ~[spring-context-4.3.2.release.jar:4.3.2.release] @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:541) ~[spring-context-4.3.2.release.jar:4.3.2.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.refresh(embeddedwebapplicationcontext.java:122) ~[spring-boot-1.4.0.release.jar:1.4.0.release] @ org.springframework.boot.springapplication.refresh(springapplication.java:759) [spring-boot-1.4.0.release.jar:1.4.0.release] @ org.springframework.boot.springapplication.refreshcontext(springapplication.java:369) [spring-boot-1.4.0.release.jar:1.4.0.release] @ org.springframework.boot.springapplication.run(springapplication.java:313) [spring-boot-1.4.0.release.jar:1.4.0.release] @ org.springframework.boot.springapplication.run(springapplication.java:1185) [spring-boot-1.4.0.release.jar:1.4.0.release] @ org.springframework.boot.springapplication.run(springapplication.java:1174) [spring-boot-1.4.0.release.jar:1.4.0.release] @ com.alledu.alleduapplication.main(alleduapplication.java:10) [bin/:na] @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) ~[na:1.8.0_51] @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) ~[na:1.8.0_51] @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) ~[na:1.8.0_51] @ java.lang.reflect.method.invoke(method.java:497) ~[na:1.8.0_51] @ org.springframework.boot.devtools.restart.restartlauncher.run(restartlauncher.java:49) [spring-boot-devtools-1.4.0.release.jar:1.4.0.release] caused by: javax.persistence.persistenceexception: [persistenceunit: default] unable build hibernate sessionfactory @ org.hibernate.jpa.boot.internal.entitymanagerfactorybuilderimpl.persistenceexception(entitymanagerfactorybuilderimpl.java:954) ~[hibernate-entitymanager-5.0.9.final.jar:5.0.9.final] @ org.hibernate.jpa.boot.internal.entitymanagerfactorybuilderimpl.build(entitymanagerfactorybuilderimpl.java:882) ~[hibernate-entitymanager-5.0.9.final.jar:5.0.9.final] @ org.springframework.orm.jpa.vendor.springhibernatejpapersistenceprovider.createcontainerentitymanagerfactory(springhibernatejpapersistenceprovider.java:60) ~[spring-orm-4.3.2.release.jar:4.3.2.release] @ org.springframework.orm.jpa.localcontainerentitymanagerfactorybean.createnativeentitymanagerfactory(localcontainerentitymanagerfactorybean.java:338) ~[spring-orm-4.3.2.release.jar:4.3.2.release] @ org.springframework.orm.jpa.abstractentitymanagerfactorybean.buildnativeentitymanagerfactory(abstractentitymanagerfactorybean.java:373) ~[spring-orm-4.3.2.release.jar:4.3.2.release] @ org.springframework.orm.jpa.abstractentitymanagerfactorybean.afterpropertiesset(abstractentitymanagerfactorybean.java:362) ~[spring-orm-4.3.2.release.jar:4.3.2.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1637) ~[spring-beans-4.3.2.release.jar:4.3.2.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1574) ~[spring-beans-4.3.2.release.jar:4.3.2.release] ... 21 common frames omitted caused by: org.hibernate.tool.schema.spi.schemamanagementexception: unable execute schema management jdbc target [create table option (id bigint not null auto_increment, value varchar(255), poll_id bigint, primary key (id))] @ org.hibernate.tool.schema.internal.targetdatabaseimpl.accept(targetdatabaseimpl.java:59) ~[hibernate-core-5.0.9.final.jar:5.0.9.final] @ org.hibernate.tool.schema.internal.schemamigratorimpl.applysqlstring(schemamigratorimpl.java:431) ~[hibernate-core-5.0.9.final.jar:5.0.9.final] @ org.hibernate.tool.schema.internal.schemamigratorimpl.applysqlstrings(schemamigratorimpl.java:420) ~[hibernate-core-5.0.9.final.jar:5.0.9.final] @ org.hibernate.tool.schema.internal.schemamigratorimpl.createtable(schemamigratorimpl.java:236) ~[hibernate-core-5.0.9.final.jar:5.0.9.final] @ org.hibernate.tool.schema.internal.schemamigratorimpl.domigrationtotargets(schemamigratorimpl.java:167) ~[hibernate-core-5.0.9.final.jar:5.0.9.final] @ org.hibernate.tool.schema.internal.schemamigratorimpl.domigration(schemamigratorimpl.java:60) ~[hibernate-core-5.0.9.final.jar:5.0.9.final] @ org.hibernate.tool.hbm2ddl.schemaupdate.execute(schemaupdate.java:134) ~[hibernate-core-5.0.9.final.jar:5.0.9.final] @ org.hibernate.tool.hbm2ddl.schemaupdate.execute(schemaupdate.java:101) ~[hibernate-core-5.0.9.final.jar:5.0.9.final] @ org.hibernate.internal.sessionfactoryimpl.<init>(sessionfactoryimpl.java:470) ~[hibernate-core-5.0.9.final.jar:5.0.9.final] @ org.hibernate.boot.internal.sessionfactorybuilderimpl.build(sessionfactorybuilderimpl.java:444) ~[hibernate-core-5.0.9.final.jar:5.0.9.final] @ org.hibernate.jpa.boot.internal.entitymanagerfactorybuilderimpl.build(entitymanagerfactorybuilderimpl.java:879) ~[hibernate-entitymanager-5.0.9.final.jar:5.0.9.final] ... 27 common frames omitted caused by: com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'option (id bigint not null auto_increment, value varchar(255), poll_id bigint, p' @ line 1 @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) ~[na:1.8.0_51] @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62) ~[na:1.8.0_51] @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45) ~[na:1.8.0_51] @ java.lang.reflect.constructor.newinstance(constructor.java:422) ~[na:1.8.0_51] @ com.mysql.jdbc.util.handlenewinstance(util.java:404) ~[mysql-connector-java-5.1.39.jar:5.1.39] @ com.mysql.jdbc.util.getinstance(util.java:387) ~[mysql-connector-java-5.1.39.jar:5.1.39] @ com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:942) ~[mysql-connector-java-5.1.39.jar:5.1.39] @ com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:3966) ~[mysql-connector-java-5.1.39.jar:5.1.39] @ com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:3902) ~[mysql-connector-java-5.1.39.jar:5.1.39] @ com.mysql.jdbc.mysqlio.sendcommand(mysqlio.java:2526) ~[mysql-connector-java-5.1.39.jar:5.1.39] @ com.mysql.jdbc.mysqlio.sqlquerydirect(mysqlio.java:2673) ~[mysql-connector-java-5.1.39.jar:5.1.39] @ com.mysql.jdbc.connectionimpl.execsql(connectionimpl.java:2545) ~[mysql-connector-java-5.1.39.jar:5.1.39] @ com.mysql.jdbc.statementimpl.executeupdateinternal(statementimpl.java:1540) ~[mysql-connector-java-5.1.39.jar:5.1.39] @ com.mysql.jdbc.statementimpl.executelargeupdate(statementimpl.java:2595) ~[mysql-connector-java-5.1.39.jar:5.1.39] @ com.mysql.jdbc.statementimpl.executeupdate(statementimpl.java:1468) ~[mysql-connector-java-5.1.39.jar:5.1.39] @ org.hibernate.tool.schema.internal.targetdatabaseimpl.accept(targetdatabaseimpl.java:56) ~[hibernate-core-5.0.9.final.jar:5.0.9.final] ... 37 common frames omitted
the problem occurs when add starter-web in gradle file:
.... dependencies { compile('org.projectlombok:lombok') compile('org.springframework.boot:spring-boot-starter-data-jpa') compile('org.springframework.boot:spring-boot-starter-web') compile('org.springframework.boot:spring-boot-starter-security') compile('org.springframework.boot:spring-boot-devtools') compile('io.springfox:springfox-swagger2:2.5.0') compile('io.springfox:springfox-swagger-ui:2.5.0') runtime('mysql:mysql-connector-java') } ....
application.properties
# connection url database spring.datasource.url = jdbc:mysql://localhost:3306/alledu?usessl=false # username , password spring.datasource.username = user spring.datasource.password = pass spring.jpa.hibernate.ddl-auto = update spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.mysql5dialect
thx - bit desperate
acutaly error show detail info
you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'option (id bigint not null auto_increment, value varchar(255), poll_id bigint, p' @ line 1
where option
keywords , reserved words in mysql 5.7, can refer section table 10.2 keywords , reserved words in mysql 5.7
Comments
Post a Comment