【问题标题】:Application Deployment failing on cloud foundry due to entityManagerFactory bean creation failed由于 entityManagerFactory bean 创建失败,Cloud Foundry 上的应用程序部署失败
【发布时间】:2020-02-17 03:48:31
【问题描述】:

在 Cloud Foundry 上部署 Spring Boot 微服务时遇到以下错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [com/ge/pd/reports/config/HibernateConfig.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;

当我检查了许多关于堆栈溢出的解决方案和许多其他门户的解决方案时,所有解决方案都与 jar 版本冲突有关。

我已经消除了应用程序中的所有冲突 jar,并更新了所有需要的 jar 版本。

I am using below jar and its version:
hibernate-core-5.0.12.Final.jar - 5.0.12
hibernate-jpa-2.1-api-1.0.0.Final.jar   - 2.1
hibernate-entitymanager-5.0.12.Final.jar - 5.0.12
openjpa-2.4.0.jar - 2.4.0

请提供解决方案。

【问题讨论】:

  • 在提出家庭作业类型的问题时,请表现出您最好的诚意尝试解决它并说出您遇到的问题。这将使我们更好地了解您正在尝试做什么、您可能做错了什么以及您需要帮助什么。请浏览tourhelpHow to Ask 部分,了解本网站的工作原理并帮助您改进当前和未来的问题。 meta.stackoverflow.com/questions/334822/…

标签: java hibernate spring-boot openjpa hibernate-entitymanager


【解决方案1】:

这确实看起来像是依赖冲突,更具体地说,是在 Hibernate 5.0.12 (which uses JPA 2.1) 和 OpenJPA 2.4.0 (which uses JPA 2.0) 之间。尝试删除 OpenJPA 依赖项。

this SO线程所示,JPA 2.1中引入了上述方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-10
    • 2019-08-28
    • 2021-05-04
    • 1970-01-01
    • 2017-08-16
    • 2019-03-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多