HHH000206:找不到hibernate.properties,并且在类路径资源中创建名称为'entityManagerFactory'的bean时出错

时间:2019-05-05 16:23:14

标签: hibernate spring-boot jpa hibernate-entitymanager

。 ____ _ __ _ _ _  / \ / ' __ _ )_ __ __ _ _ \ \ \ \ (()_ |'_ |' | |' / `| \ \ \ \  \ / )| | )| | | | | || ( | | |))))   '| ____ | | |。 | | | | __,| / / / /  ======== | _ | ============= | ___ / = / / / _ /  :: Spring Boot ::(v2.1.4.RELEASE)

2019-05-05 18:02:43.150信息18704-[重新启动主] cppfa.projetpfa.ProjetpfaApplication:使用PID 18704在DESKTOP-QO4NQ82上启动ProjetpfaApplication(C:\ Users \ mr-el \ Desktop \ BOOTSPRING \ projetpfa \ target \ classes由Mr-el在C:\ Users \ mr-el \ Desktop \ BOOTSPRING \ projetpfa中启动) 2019-05-05 18:02:43.153信息18704-[重新启动主] c.p.pfa.projetpfa.ProjetpfaApplication:未设置活动配置文件,回退到默认配置文件:默认 2019-05-05 18:02:43.526信息18704 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor:Devtools属性默认为活动状态!将'spring.devtools.add-properties'设置为'false'以禁用 2019-05-05 18:02:43.526信息18704-[重新启动的主] .e.DevToolsPropertyDefaultsPostProcessor:对于其他与Web相关的日志记录,请考虑将'logging.level.web'属性设置为'DEBUG' 2019-05-05 18:02:45.756信息18704-[[restartedMain] .s.d.r.c.RepositoryConfigurationDelegate:在默认模式下引导Spring数据存储库。 2019-05-05 18:02:45.957信息18704 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate:完成Spring数据存储库的扫描时间为183ms。找到1个存储库接口。 2019-05-05 18:02:47.651信息18704-[[startedMain] trationDelegate $ BeanPostProcessorChecker:类型为[org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration $$ EnhancerBySpringCGLIB $的Bean'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' $ 20db622e]不符合所有BeanPostProcessor的处理要求(例如:不符合自动代理的条件) 2019-05-05 18:02:49.095信息18704 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer:使用端口初始化的Tomcat:8443(http) 2019-05-05 18:02:49.233信息18704-[[restartMain] o.apache.catalina.core.StandardService:正在启动服务[Tomcat] 2019-05-05 18:02:49.233信息18704-[[restartedMain] org.apache.catalina.core.StandardEngine:启动Servlet引擎:[Apache Tomcat / 9.0.17] 2019-05-05 18:02:49.670信息18704 --- [restartedMain] o.a.c.c.C. [Tomcat]。[localhost]。[/]:初始化Spring嵌入式WebApplicationContext 2019-05-05 18:02:49.670信息18704-[[restartedMain] o.s.web.context.ContextLoader:根WebApplicationContext:初始化在6144毫秒内完成 正在加载类com.mysql.jdbc.Driver'. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver'。通过SPI自动注册驱动程序,通常不需要手动加载驱动程序类。 2019-05-05 18:02:51.244信息18704-[[restartedMain] com.zaxxer.hikari.HikariDataSource:HikariPool-1-正在启动... 2019-05-05 18:02:51.245警告18704 --- [restartedMain] com.zaxxer.hikari.util.DriverDataSource:找不到具有driverClassName = com.mysql.jdbc.Driver的注册驱动程序,尝试直接实例化。 2019-05-05 18:02:51.982信息18704-[[restartedMain] com.zaxxer.hikari.HikariDataSource:HikariPool-1-开始完成。 2019-05-05 18:02:52.410信息18704-[[startedMain] o.hibernate.jpa.internal.util.LogHelper:HHH000204:处理PersistenceUnitInfo [     名称:默认     ...] 2019-05-05 18:02:52.699信息18704-[[restartedMain] org.hibernate.Version:HHH000412:Hibernate Core {5.3.9.Final} 2019-05-05 18:02:52.700信息18704 --- [restartedMain] org.hibernate.cfg.Environment:HHH000206:找不到hibernate.properties 2019-05-05 18:02:53.274信息18704 --- [restartMain] o.hibernate.annotations.common.Version:HCANN000001:Hibernate Commons注释{5.0.4.Final} 2019-05-05 18:03:04.757信息18704-[[remainedMain] org.hibernate.dialect.Dialect:HHH000400:使用方言:org.hibernate.dialect.MySQL5Dialect 2019-05-05 18:03:05.541警告18704 --- [restartedMain] ConfigServletWebServerApplicationContext:上下文初始化期间遇到异常-取消刷新尝试:org.springframework.beans.factory.BeanCreationException:创建名称定义为'entityManagerFactory'的bean时出错类路径资源[org / springframework / boot / autoconfigure / orm / jpa / HibernateJpaConfiguration.class]:调用init方法失败;嵌套异常是org.hibernate.AnnotationException:mappedBy通过引用未知目标实体属性:com.projet.pfa.projetpfa.models.Formateur.AffecFormationGroup中的com.projet.pfa.projetpfa.models.AffecFormationGroupe.Formateur 2019-05-05 18:03:05.542信息18704-[[restartedMain] com.zaxxer.hikari.HikariDataSource:HikariPool-1-关闭启动... 2019-05-05 18:03:05.547信息18704-[[restartedMain] com.zaxxer.hikari.HikariDataSource:HikariPool-1-关闭已完成。 2019-05-05 18:03:05.554信息18704-[[restartMain] o.apache.catalina.core.StandardService:正在停止服务[Tomcat] 2019-05-05 18:03:05.582信息18704 --- [restartedMain] ConditionEvaluationReportLoggingListener:

启动ApplicationContext时出错。要显示条件报告,请在启用“调试”的情况下重新运行您的应用程序。 2019-05-05 18:03:05.603错误18704 --- [restartedMain] o.s.boot.SpringApplication:应用程序运行失败

org.springframework.beans.factory.BeanCreationException:在类路径资源[org / springframework / boot / autoconfigure / orm / jpa / HibernateJpaConfiguration.class]中创建名称为'entityManagerFactory'的bean时出错:调用init方法失败;嵌套异常是org.hibernate.AnnotationException:mappedBy通过引用未知目标实体属性:com.projet.pfa.projetpfa.models.Formateur.AffecFormationGroup中的com.projet.pfa.projetpfa.models.AffecFormationGroupe.Formateur     在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778)〜[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)〜[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)〜[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.beans.factory.support.AbstractBeanFactory.lambda $ doGetBean $ 0(AbstractBeanFactory.java:320)〜[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)〜[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)〜[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)〜[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105)〜[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)〜[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)〜[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)〜[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]     在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)上[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]     在org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)上[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]     在org.springframework.boot.SpringApplication.run(SpringApplication.java:316)上[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]     在org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)上[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]     在org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)上[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]     在com.projet.pfa.projetpfa.ProjetpfaApplication.main(ProjetpfaApplication.java:10)[classes /:na]     在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处〜[na:1.8.0_201]     在sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)〜[na:1.8.0_201]     在sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)〜[na:1.8.0_201]     在java.lang.reflect.Method.invoke(未知来源)〜[na:1.8.0_201]     在org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)[spring-boot-devtools-2.1.4.RELEASE.jar:2.1.4.RELEASE] 造成原因:org.hibernate.AnnotationException:mappedBy引用了未知的目标实体属性:com.projet.pfa.projetpfa.models.Formateur.AffecFormationGroup中的com.projet.pfa.projetpfa.models.AffecFormationGroupe.Formateur     在org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:785)〜[hibernate-core-5.3.9.Final.jar:5.3.9.Final]     在org.hibernate.cfg.annotations.CollectionBinder $ 1.secondPass(CollectionBinder.java:736)〜[hibernate-core-5.3.9.Final.jar:5.3.9.Final]     在org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:54)〜[hibernate-core-5.3.9.Final.jar:5.3.9.Final]     在org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1696)〜[hibernate-core-5.3.9.Final.jar:5.3.9.Final]     在org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1664)〜[hibernate-core-5.3.9.Final.jar:5.3.9.Final]     在org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:287)〜[hibernate-core-5.3.9.Final.jar:5.3.9.Final]     在org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:904)〜[hibernate-core-5.3.9.Final.jar:5.3.9.Final]     在org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:935)〜[hibernate-core-5.3.9.Final.jar:5.3.9.Final]     在org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:57)〜[spring-orm-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)〜[spring-orm-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390)〜[spring-orm-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377)〜[spring-orm-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)〜[spring-orm-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837)〜[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]     在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)〜[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]     ...省略了21个常见框架

您好,当我运行我的项目时,出现此错误

1 个答案:

答案 0 :(得分:0)

相关部分是

mappedBy reference an unknown target entity property: com.projet.pfa.projetpfa.models.AffecFormationGroupe.Formateur in com.projet.pfa.projetpfa.models.Formateur.AffecFormationGroup

您确定吗?

  • 在堆栈跟踪中提到的mappedBy属性中没有错字
  • 目标类被标记为@Entity
  • 是否已正确发现?