當我編譯我的spring引導項目時,出現以下錯誤。創建名爲'entityManagerFactory'spring引導應用程序的bean時出錯
org.springframework.beans.factory.BeanCreationException:錯誤 創建名爲 '的entityManagerFactory' 在類路徑中定義 資源 [COM/biganalytics /項目/配置/ JpaConfiguration.class]豆芽:黃 通過實例工廠方法失敗;嵌套異常是 org.springframework.beans.BeanInstantiationException:失敗 實例化 [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: 工廠方法'entityManagerFactory'拋出異常;嵌套0例外是java.lang.IllegalStateException:所需的關鍵 [datasource.sampleapp.hibernate.dialect]不 org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)發現 〜[彈簧-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]在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) 〜[彈簧豆-4.3.6.RELEASE.jar:4.3.6 .RELEASE]在 org.springframework.be org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory [] [] [] [] [] [] [] [] [] [] [] [] [] .createBean(AbstractAutowireCapableBeanFactory.java:483) 〜[彈簧豆-4.3.6.RELEASE.jar:4.3.6.RELEASE]在 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.doGet Bean(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]在 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:856) 〜[彈簧上下文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] org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) 〜[spring-boot-1.5.1.RELEASE.jar: 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。org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE] org.springframework.boot.SpringApplication。運行(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'拋出異常;嵌套0例外是java.lang.IllegalStateException:所需的關鍵 [datasource.sampleapp.hibernate.dialect]不 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)發現 〜[彈簧-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] 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]在 com.biganalytics.project.configuration.JpaConfiguration $$ EnhancerBySpringCGLIB $$ 5f74f23d $$ FastClassBySpringCGL IB $$ 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]在 org.springframework.context.annotation.ConfigurationClassEnhancer $ BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356) 〜[彈簧上下文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 Method)〜[na:1.8.0_112] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 〜[na:1.8.0_112] at sun .delegatingMethodAccessorImpl.invoke(Unknown Source) 〜[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) 〜[彈簧豆-4.3.6.RELEASE.jar:4.3.6.RELEASE] ... 19個共同幀 省略
燦請幫助
轉儲堆棧跟蹤並期望幫助不是一個真正的問問題的好方法。請參閱http://stackoverflow.com/help/how-to-ask瞭解如何提出問題並改善問題。 (答案基本上在你的堆棧跟蹤中,因爲它告訴你什麼是缺失的)。 –
添加你的application.properties文件 –