java – Error creating bean with name entityManagerFactory defined in class path resource : Invocation of init method failed

java – Error creating bean with name entityManagerFactory defined in class path resource : Invocation of init method failed

I would start by adding the following dependency:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>4.1.4.Final</version>
</dependency>

and

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>5.2.3.Final</version>
</dependency>

UPDATE: Or simply add the following dependency.

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.0</version>
</dependency>

People using Java 9 include this dependency:

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.0</version>
</dependency>

java – Error creating bean with name entityManagerFactory defined in class path resource : Invocation of init method failed

Adding dependencies didnt fix the issue at my end.

The issue was happening at my end because of additional fields that are part of the @Entity class and dont exist in the database.

I removed the additional fields from the @Entity class and it worked.

Goodluck.

Leave a Reply

Your email address will not be published.