lives
lives

Reputation: 1185

Spring Data JPA Repository Error

I get the below error during deployment of a Spring web application.

java.lang.AbstractMethodError: org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(Ljava/lang/reflect/Method;Lorg/springframework/data/repository/core/RepositoryMetadata;Lorg/springframework/data/projection/ProjectionFactory;Lorg/springframework/data/repository/core/NamedQueries;)Lorg/springframework/data/repository/query/RepositoryQuery;
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]

The below link suggests to check compatibility between spring-data-commons and spring-data-jpa and it is fine.

Spring CrudRepository throws AbstractMethodError on custom query method definition

Could anything else create the issue ?

Below is my repository code

public interface MyRepository extends JpaRepository<MyEntityy, Long>

i corrected the spring-data-commons to spring-data-commons-1.11.0.RELEASE and now I get a different error.

java.lang.AbstractMethodError: org.springframework.data.repository.core.support.RepositoryFactorySupport.getTargetRepository(Lorg/springframework/data/repository/core/RepositoryMetadata;)Ljava/lang/Object;; nested exception is org.springframework.beans.factory.BeanCreationException:

Upvotes: 1

Views: 2304

Answers (1)

lives
lives

Reputation: 1185

The issue was related to incompatibility between Spring-data-JPA and Spring-Data-Commons.

Spring-Data-JPA-1.9.0 is complaint with Spring-Data-Commons-1.11.0

My project had dependency to spring-data-elasticsearch which had pulled a different version of spring-data-commons - because of which I faced the above issue

Upvotes: 1

Related Questions