-1

I am facing below error while deploying spring boot microservice on cloud foundry:

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;

As I checked many resolution on stack overflow and many other portals for the solution, All the solution are related to jar version conflicts.

I have eliminated all the conflicts jar from the application and updated with all the jar versions which is required.

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

Please Provide the Solution.

seenukarthi
  • 8,241
  • 10
  • 47
  • 68
  • When asking homework type questions, show your best good faith attempt to solve it and tell what problems you are having. This will give us a better understanding of what you're trying to do, what you might be doing wrong, and what you need help with. Please go through the [tour](https://stackoverflow.com/tour), the [help](https://stackoverflow.com/help), the [How to Ask](https://stackoverflow.com/how-to-ask), sections to see how this site works and to help you improve your current and future questions. https://meta.stackoverflow.com/questions/334822/how-do-i-ask-and-answer-homework-questions – FailingCoder Oct 21 '19 at 04:26

1 Answers1

1

This indeed looks like a dependency conflict, more specifically, between Hibernate 5.0.12 (which uses JPA 2.1) and OpenJPA 2.4.0 (which uses JPA 2.0). Try removing the OpenJPA dependency.

As this SO thread shows, the said method was introduced in JPA 2.1.

kidney
  • 2,663
  • 17
  • 23