创建名称为' entityManagerFactory'的bean时出错spring boot application

时间:2017-02-23 10:26:15

标签: hibernate jpa spring-boot

编译弹簧启动项目时,出现以下错误。

  

org.springframework.beans.factory.BeanCreationException:错误   创建名为&entityManagerFactory'的bean在类路径中定义   资源   [com / biganalytics / project / configuration / JpaConfiguration.class]:Bean   通过工厂方法实例化失败;嵌套异常是   org.springframework.beans.BeanInstantiationException:失败   实例   [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]:   工厂方法' entityManagerFactory'抛出异常;嵌套   异常是java.lang.IllegalStateException:必需的键   找不到[datasource.sampleapp.hibernate.dialect]   org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)   〜[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)   〜[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)   〜[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)   〜[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)   〜[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:306)   〜[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)   〜[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)   〜[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)   〜[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081)   〜[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:856)   〜[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)   〜[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)   〜[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE] at   org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)   [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE] at   org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)   [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE] at   org.springframework.boot.SpringApplication.run(SpringApplication.java:314)   [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE] at   org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)   [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE] at   org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)   [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE] at   com.biganalytics.project.WebApplication.main(WebApplication.java:19)   [classes /:na]引起:   org.springframework.beans.BeanInstantiationException:失败   实例   [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]:   工厂方法' entityManagerFactory'抛出异常;嵌套   异常是java.lang.IllegalStateException:必需的键   找不到[datasource.sampleapp.hibernate.dialect]   org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)   〜[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)   〜[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] ... 18个常见帧   省略:java.lang.IllegalStateException:必需的键   找不到[datasource.sampleapp.hibernate.dialect]   org.springframework.core.env.AbstractPropertyResolver.getRequiredProperty(AbstractPropertyResolver.java:183)   〜[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.core.env.AbstractEnvironment.getRequiredProperty(AbstractEnvironment.java:556)   〜[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   com.biganalytics.project.configuration.JpaConfiguration.jpaProperties(JpaConfiguration.java:99)   〜[classes /:na] at   com.biganalytics.project.configuration.JpaConfiguration.entityManagerFactory(JpaConfiguration.java:81)   〜[classes /:na] at   com.biganalytics.project.configuration.JpaConfiguration $$ EnhancerBySpringCGLIB $$ 5f74f23d.CGLIB $ entityManagerFactory的$ 1()   〜[classes /:na] at   com.biganalytics.project.configuration.JpaConfiguration $$ EnhancerBySpringCGLIB $$ 5f74f23d $$ FastClassBySpringCGLIB $$ 6189aa41.invoke()   〜[classes /:na] at   org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)   〜[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   org.springframework.context.annotation.ConfigurationClassEnhancer $ BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)   〜[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE] at   com.biganalytics.project.configuration.JpaConfiguration $$ EnhancerBySpringCGLIB $$ 5f74f23d.entityManagerFactory()   〜[classes /:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native   方法)〜[na:1.8.0_112] at   sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)   〜[na:1.8.0_112] at   sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)   〜[na:1.8.0_112] at java.lang.reflect.Method.invoke(Unknown Source)   〜[na:1.8.0_112] at   org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)   〜[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] ... 19个常见帧   省略

可以帮助

0 个答案:

没有答案