Reputation: 450
Below are the dependency version details on the pom.xml
<!-- spring -->
<org.springframework-version>4.2.2.RELEASE</org.springframework-version>
<org.springframework.data-version>1.11.0.RELEASE</org.springframework.data-version>
<!-- hibernate -->
<org.hibernate.hibernate-core>5.0.2.Final</org.hibernate.hibernate-core>
<org.hibernate.hibernate-annotations>3.5.6-Final</org.hibernate.hibernate-annotations>
<org.hibernate.hibernate-commons-annotations>3.2.0.Final</org.hibernate.hibernate-commons-annotations>
<org.hibernate.hibernate-validator>5.2.2.Final</org.hibernate.hibernate-validator>
I'd picked the Hibernate version details from the "spring-orm" pom and found the Hibernate 5.0.2 is compatible with Spring 4.2.2
With the same dependencies in-case of Spring core and Hibernate it's working fine and giving desired result. But with Spring MVC and Hibernate integration, it's giving below error
Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.cfg.annotations.reflection.JPAMetadataProvider.(Lorg/hibernate/boot/spi/MetadataBuildingOptions;)V
If any further information is needed, please put in the comment section. I will provide the entire configuration details.
Thanks in Advance. :-)
Upvotes: 0
Views: 1893
Reputation: 450
On removing the below dependencies from pom.xml has resolved the issue.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.6-Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.2.0.Final</version>
</dependency>
Because of this dependencies, there was conflict on the Resolved dependencies.(Refer the pic attached on the question).
hibernate-annotations is not required, It was dependent on older version of hibernate-core and hibernate-commons-annotations
hibernate-commons-annotations (version 5.0.2) is present in hibernate-core as a dependent jar. So it's not required to mention older version in pom.xml
Upvotes: 1