getting the following error while trying to call my method which looks like findAll(criteria, recordLimit, recordOffset, Sort.by(DESC,MODIFIED_DATE)) java.lang.NoSuchMethodError: org.springframework.data.domain.Sort.by(Lorg/springframework/data/domain/Sort$Direction;[Ljava/lang/String;)Lorg/springframework/data/domain/Sort;
Using Spring-data-commons-2.1.3.RELEASE.jar
Here is the relevant portion of the pom:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>2.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons-core</artifactId>
<version>1.4.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
</dependency>
CodePudding user response:
You are referencing spring-data-commons
and spring-data-commons-core
, the latter being very, very old. It has a conflicting class Sort
that's being used at runtime instead of the one you want/need from spring-data-commons
.
Remove the dependency on spring-data-commons-core
and re-build.