java - JPA Sample Spring Boot app throws BeanCreationException -


i'm trying simple spring project work, downloaded starter project here (maven, jpa dependency want use hibernate):

https://start.spring.io/

i ran: mvn clean install

which threw lot of errors:

--- exec-maven-plugin:1.2.1:exec (default-cli) @ project ---    .   ____          _            __ _ _  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )   '  |____| .__|_| |_|_| |_\__, | / / / /  =========|_|==============|___/=/_/_/_/  :: spring boot ::        (v1.3.5.release)  2016-06-11 11:52:57.644  info 20700 --- [           main] com.app.projectapplication               : starting projectapplication on jameswmac.local pid 20700 (started james in /users/james/downloads/project 2) 2016-06-11 11:52:57.647  info 20700 --- [           main] com.app.projectapplication               : no active profile set, falling default profiles: default 2016-06-11 11:52:57.679  info 20700 --- [           main] s.c.a.annotationconfigapplicationcontext : refreshing org.springframework.context.annotation.annotationconfigapplicationcontext@376b4233: startup date [sat jun 11 11:52:57 est 2016]; root of context hierarchy 2016-06-11 11:52:58.248  warn 20700 --- [           main] s.c.a.annotationconfigapplicationcontext : exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.beancreationexception: error creating bean name 'org.springframework.boot.autoconfigure.orm.jpa.hibernatejpaautoconfiguration': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private javax.sql.datasource org.springframework.boot.autoconfigure.orm.jpa.jpabaseconfiguration.datasource; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/datasourceautoconfiguration$nonembeddedconfiguration.class]: bean instantiation via factory method failed; nested exception org.springframework.beans.beaninstantiationexception: failed instantiate [javax.sql.datasource]: factory method 'datasource' threw exception; nested exception org.springframework.boot.autoconfigure.jdbc.datasourceproperties$datasourcebeancreationexception: cannot determine embedded database driver class database type none. if want embedded database please put supported 1 on classpath. if have database settings loaded particular profile may need active (no profiles active). 2016-06-11 11:52:58.260 error 20700 --- [           main] o.s.boot.springapplication               : application startup failed  org.springframework.beans.factory.beancreationexception: error creating bean name 'org.springframework.boot.autoconfigure.orm.jpa.hibernatejpaautoconfiguration': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private javax.sql.datasource org.springframework.boot.autoconfigure.orm.jpa.jpabaseconfiguration.datasource; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/datasourceautoconfiguration$nonembeddedconfiguration.class]: bean instantiation via factory method failed; nested exception org.springframework.beans.beaninstantiationexception: failed instantiate [javax.sql.datasource]: factory method 'datasource' threw exception; nested exception org.springframework.boot.autoconfigure.jdbc.datasourceproperties$datasourcebeancreationexception: cannot determine embedded database driver class database type none. if want embedded database please put supported 1 on classpath. if have database settings loaded particular profile may need active (no profiles active).     @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor.postprocesspropertyvalues(autowiredannotationbeanpostprocessor.java:334) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.populatebean(abstractautowirecapablebeanfactory.java:1214) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:543) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:482) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:197) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.constructorresolver.instantiateusingfactorymethod(constructorresolver.java:368) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.instantiateusingfactorymethod(abstractautowirecapablebeanfactory.java:1123) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbeaninstance(abstractautowirecapablebeanfactory.java:1018) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:510) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:482) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:197) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.context.support.abstractapplicationcontext.getbean(abstractapplicationcontext.java:1054) ~[spring-context-4.2.6.release.jar:4.2.6.release]     @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:829) ~[spring-context-4.2.6.release.jar:4.2.6.release]     @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:538) ~[spring-context-4.2.6.release.jar:4.2.6.release]     @ org.springframework.boot.springapplication.refresh(springapplication.java:766) [spring-boot-1.3.5.release.jar:1.3.5.release]     @ org.springframework.boot.springapplication.createandrefreshcontext(springapplication.java:361) [spring-boot-1.3.5.release.jar:1.3.5.release]     @ org.springframework.boot.springapplication.run(springapplication.java:307) [spring-boot-1.3.5.release.jar:1.3.5.release]     @ org.springframework.boot.springapplication.run(springapplication.java:1191) [spring-boot-1.3.5.release.jar:1.3.5.release]     @ org.springframework.boot.springapplication.run(springapplication.java:1180) [spring-boot-1.3.5.release.jar:1.3.5.release]     @ com.app.projectapplication.main(projectapplication.java:10) [classes/:na] caused by: org.springframework.beans.factory.beancreationexception: not autowire field: private javax.sql.datasource org.springframework.boot.autoconfigure.orm.jpa.jpabaseconfiguration.datasource; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/datasourceautoconfiguration$nonembeddedconfiguration.class]: bean instantiation via factory method failed; nested exception org.springframework.beans.beaninstantiationexception: failed instantiate [javax.sql.datasource]: factory method 'datasource' threw exception; nested exception org.springframework.boot.autoconfigure.jdbc.datasourceproperties$datasourcebeancreationexception: cannot determine embedded database driver class database type none. if want embedded database please put supported 1 on classpath. if have database settings loaded particular profile may need active (no profiles active).     @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfieldelement.inject(autowiredannotationbeanpostprocessor.java:573) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.annotation.injectionmetadata.inject(injectionmetadata.java:88) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor.postprocesspropertyvalues(autowiredannotationbeanpostprocessor.java:331) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     ... 25 common frames omitted caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/datasourceautoconfiguration$nonembeddedconfiguration.class]: bean instantiation via factory method failed; nested exception org.springframework.beans.beaninstantiationexception: failed instantiate [javax.sql.datasource]: factory method 'datasource' threw exception; nested exception org.springframework.boot.autoconfigure.jdbc.datasourceproperties$datasourcebeancreationexception: cannot determine embedded database driver class database type none. if want embedded database please put supported 1 on classpath. if have database settings loaded particular profile may need active (no profiles active).     @ org.springframework.beans.factory.support.constructorresolver.instantiateusingfactorymethod(constructorresolver.java:599) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.instantiateusingfactorymethod(abstractautowirecapablebeanfactory.java:1123) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbeaninstance(abstractautowirecapablebeanfactory.java:1018) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:510) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:482) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:197) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.findautowirecandidates(defaultlistablebeanfactory.java:1192) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.doresolvedependency(defaultlistablebeanfactory.java:1116) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.resolvedependency(defaultlistablebeanfactory.java:1014) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfieldelement.inject(autowiredannotationbeanpostprocessor.java:545) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     ... 27 common frames omitted caused by: org.springframework.beans.beaninstantiationexception: failed instantiate [javax.sql.datasource]: factory method 'datasource' threw exception; nested exception org.springframework.boot.autoconfigure.jdbc.datasourceproperties$datasourcebeancreationexception: cannot determine embedded database driver class database type none. if want embedded database please put supported 1 on classpath. if have database settings loaded particular profile may need active (no profiles active).     @ org.springframework.beans.factory.support.simpleinstantiationstrategy.instantiate(simpleinstantiationstrategy.java:189) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     @ org.springframework.beans.factory.support.constructorresolver.instantiateusingfactorymethod(constructorresolver.java:588) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     ... 39 common frames omitted caused by: org.springframework.boot.autoconfigure.jdbc.datasourceproperties$datasourcebeancreationexception: cannot determine embedded database driver class database type none. if want embedded database please put supported 1 on classpath. if have database settings loaded particular profile may need active (no profiles active).     @ org.springframework.boot.autoconfigure.jdbc.datasourceproperties.getdriverclassname(datasourceproperties.java:180) ~[spring-boot-autoconfigure-1.3.5.release.jar:1.3.5.release]     @ org.springframework.boot.autoconfigure.jdbc.datasourceautoconfiguration$nonembeddedconfiguration.datasource(datasourceautoconfiguration.java:121) ~[spring-boot-autoconfigure-1.3.5.release.jar:1.3.5.release]     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) ~[na:1.8.0_05]     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) ~[na:1.8.0_05]     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) ~[na:1.8.0_05]     @ java.lang.reflect.method.invoke(method.java:483) ~[na:1.8.0_05]     @ org.springframework.beans.factory.support.simpleinstantiationstrategy.instantiate(simpleinstantiationstrategy.java:162) ~[spring-beans-4.2.6.release.jar:4.2.6.release]     ... 40 common frames omitted  2016-06-11 11:52:58.262  info 20700 --- [           main] .b.l.classpathloggingapplicationlistener : application failed start classpath: [file:/users/james/downloads/project%202/target/classes/, file:/users/james/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/1.3.5.release/spring-boot-starter-data-jpa-1.3.5.release.jar, file:/users/james/.m2/repository/org/springframework/boot/spring-boot-starter/1.3.5.release/spring-boot-starter-1.3.5.release.jar, file:/users/james/.m2/repository/org/springframework/boot/spring-boot/1.3.5.release/spring-boot-1.3.5.release.jar, file:/users/james/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.3.5.release/spring-boot-autoconfigure-1.3.5.release.jar, file:/users/james/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.3.5.release/spring-boot-starter-logging-1.3.5.release.jar, file:/users/james/.m2/repository/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar, file:/users/james/.m2/repository/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.jar, file:/users/james/.m2/repository/org/slf4j/jul-to-slf4j/1.7.21/jul-to-slf4j-1.7.21.jar, file:/users/james/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.21/log4j-over-slf4j-1.7.21.jar, file:/users/james/.m2/repository/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar, file:/users/james/.m2/repository/org/springframework/boot/spring-boot-starter-aop/1.3.5.release/spring-boot-starter-aop-1.3.5.release.jar, file:/users/james/.m2/repository/org/springframework/spring-aop/4.2.6.release/spring-aop-4.2.6.release.jar, file:/users/james/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/users/james/.m2/repository/org/aspectj/aspectjweaver/1.8.9/aspectjweaver-1.8.9.jar, file:/users/james/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.3.5.release/spring-boot-starter-jdbc-1.3.5.release.jar, file:/users/james/.m2/repository/org/apache/tomcat/tomcat-jdbc/8.0.33/tomcat-jdbc-8.0.33.jar, file:/users/james/.m2/repository/org/apache/tomcat/tomcat-juli/8.0.33/tomcat-juli-8.0.33.jar, file:/users/james/.m2/repository/org/springframework/spring-jdbc/4.2.6.release/spring-jdbc-4.2.6.release.jar, file:/users/james/.m2/repository/org/hibernate/hibernate-entitymanager/4.3.11.final/hibernate-entitymanager-4.3.11.final.jar, file:/users/james/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.final/jboss-logging-3.3.0.final.jar, file:/users/james/.m2/repository/org/jboss/logging/jboss-logging-annotations/1.2.0.beta1/jboss-logging-annotations-1.2.0.beta1.jar, file:/users/james/.m2/repository/org/hibernate/hibernate-core/4.3.11.final/hibernate-core-4.3.11.final.jar, file:/users/james/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar, file:/users/james/.m2/repository/org/jboss/jandex/1.1.0.final/jandex-1.1.0.final.jar, file:/users/james/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar, file:/users/james/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar, file:/users/james/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.5.final/hibernate-commons-annotations-4.0.5.final.jar, file:/users/james/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.final/hibernate-jpa-2.1-api-1.0.0.final.jar, file:/users/james/.m2/repository/org/javassist/javassist/3.18.1-ga/javassist-3.18.1-ga.jar, file:/users/james/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar, file:/users/james/.m2/repository/org/springframework/data/spring-data-jpa/1.9.4.release/spring-data-jpa-1.9.4.release.jar, file:/users/james/.m2/repository/org/springframework/data/spring-data-commons/1.11.4.release/spring-data-commons-1.11.4.release.jar, file:/users/james/.m2/repository/org/springframework/spring-orm/4.2.6.release/spring-orm-4.2.6.release.jar, file:/users/james/.m2/repository/org/springframework/spring-context/4.2.6.release/spring-context-4.2.6.release.jar, file:/users/james/.m2/repository/org/springframework/spring-expression/4.2.6.release/spring-expression-4.2.6.release.jar, file:/users/james/.m2/repository/org/springframework/spring-tx/4.2.6.release/spring-tx-4.2.6.release.jar, file:/users/james/.m2/repository/org/springframework/spring-beans/4.2.6.release/spring-beans-4.2.6.release.jar, file:/users/james/.m2/repository/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar, file:/users/james/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21.jar, file:/users/james/.m2/repository/org/springframework/spring-aspects/4.2.6.release/spring-aspects-4.2.6.release.jar, file:/users/james/.m2/repository/org/springframework/spring-core/4.2.6.release/spring-core-4.2.6.release.jar] ------------------------------------------------------------------------ build failure ------------------------------------------------------------------------ total time: 1.630s finished at: sat jun 11 11:52:58 est 2016 final memory: 7m/304m ------------------------------------------------------------------------ 

the spring.io doesn't if should further setting up, i'm assuming project should work straight out of box.

could there wrong computer (maybe don't have specific library installed?), happened me on project.

the pom start.spring.io generates this:

<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelversion>4.0.0</modelversion>      <groupid>com.app</groupid>     <artifactid>project</artifactid>     <version>0.0.1-snapshot</version>     <packaging>jar</packaging>      <name>project</name>     <description>demo project spring boot</description>      <parent>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-parent</artifactid>         <version>1.3.5.release</version>         <relativepath/> <!-- lookup parent repository -->     </parent>      <properties>         <project.build.sourceencoding>utf-8</project.build.sourceencoding>         <java.version>1.8</java.version>     </properties>      <dependencies>         <dependency>             <groupid>org.springframework.boot</groupid>             <artifactid>spring-boot-starter-data-jpa</artifactid>         </dependency>          <dependency>             <groupid>org.springframework.boot</groupid>             <artifactid>spring-boot-starter-test</artifactid>             <scope>test</scope>         </dependency>     </dependencies>      <build>         <plugins>             <plugin>                 <groupid>org.springframework.boot</groupid>                 <artifactid>spring-boot-maven-plugin</artifactid>             </plugin>         </plugins>     </build>   </project> 

description in stack trace correct. in order use jpa , spring jpa support, need kind of sql data source dependency on classpath supported spring boot. can full blown sql database postgres or mysql. can small db engine commonly used testing purposes, h2.

so use h2 example, include below dependency:

<dependency>     <groupid>com.h2database</groupid>     <artifactid>h2</artifactid> </dependency> 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -