java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page <package>.ICustomSolrMediaRepository.findMediaByFilter(java.lang.String,org.springframework.data.domain.PageRequest)

Spring JIRA | David Rekowski | 6 months ago
  1. 0

    Given the following method signature {code}@Override public Page<SolrMediaEntity> findMediaByFilter(String type, PageRequest pageRequest); {code} I receive the following error: {code}Caused by: java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page <package>.ICustomSolrMediaRepository.findMediaByFilter(java.lang.String,org.springframework.data.domain.PageRequest) at org.springframework.util.Assert.isTrue(Assert.java:65) at org.springframework.data.repository.query.QueryMethod.<init>(QueryMethod.java:84) {code} Debugging into class Parameters suggests the cause may be due to this line: {code} this.pageableIndex = types.indexOf(Pageable.class); {code} one of the parameter types is {{org.springframework.data.domain.PageRequest}}, which implements Pageable, but since indexOf will not match on PageRequest, property {{pageableIndex}} becomes -1 which causes o.s.d.r.q.Parameters#hasPageableParameter to return false in the constructor of QueryMethod: {code} Assert.isTrue(this.parameters.hasPageableParameter(), ... {code} and triggers the exception. I would expect iterating the parameter types and checking for {{Pageable.class.isAssignableFrom(parameterType)}} might be required. But maybe I am missing something?

    Spring JIRA | 6 months ago | David Rekowski
    java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page <package>.ICustomSolrMediaRepository.findMediaByFilter(java.lang.String,org.springframework.data.domain.PageRequest)
  2. 0

    Given the following method signature {code}@Override public Page<SolrMediaEntity> findMediaByFilter(String type, PageRequest pageRequest); {code} I receive the following error: {code}Caused by: java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page <package>.ICustomSolrMediaRepository.findMediaByFilter(java.lang.String,org.springframework.data.domain.PageRequest) at org.springframework.util.Assert.isTrue(Assert.java:65) at org.springframework.data.repository.query.QueryMethod.<init>(QueryMethod.java:84) {code} Debugging into class Parameters suggests the cause may be due to this line: {code} this.pageableIndex = types.indexOf(Pageable.class); {code} one of the parameter types is {{org.springframework.data.domain.PageRequest}}, which implements Pageable, but since indexOf will not match on PageRequest, property {{pageableIndex}} becomes -1 which causes o.s.d.r.q.Parameters#hasPageableParameter to return false in the constructor of QueryMethod: {code} Assert.isTrue(this.parameters.hasPageableParameter(), ... {code} and triggers the exception. I would expect iterating the parameter types and checking for {{Pageable.class.isAssignableFrom(parameterType)}} might be required. But maybe I am missing something?

    Spring JIRA | 6 months ago | David Rekowski
    java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page <package>.ICustomSolrMediaRepository.findMediaByFilter(java.lang.String,org.springframework.data.domain.PageRequest)
  3. 0

    Spring boot creating beans error

    Stack Overflow | 4 months ago | rad11
    java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.elasticsearch.core.FacetedPage pl.bpo.archiwumallegro.repositories.AuctionIndexRepository.search(org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auctionIndexRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.elasticsearch.core.FacetedPage pl.bpo.archiwumallegro.repositories.AuctionIndexRepository.search(org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Application startup failed with org.hibernate:hibernate-search-orm.XYZ on class path

    GitHub | 2 years ago | dirkrathje
    java.lang.IllegalArgumentException: @ConditionalOnMissingBean annotations must specify at least one bean (type, name or annotation)
  6. 0

    Issue of pagination in Spring Data JPA

    Stack Overflow | 5 years ago | Tom
    java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter!

  1. batwalrus76 1 times, last 1 week ago
  2. kjhdofjosvs 1 times, last 3 weeks ago
  3. j.kienzle 1 times, last 1 month ago
  4. Luka 2 times, last 2 months ago
  5. andyglick 1 times, last 3 months ago
4 more registered users
29 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalArgumentException

    Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page <package>.ICustomSolrMediaRepository.findMediaByFilter(java.lang.String,org.springframework.data.domain.PageRequest)

    at org.springframework.util.Assert.isTrue()
  2. Spring Core
    Assert.isTrue
    1. org.springframework.util.Assert.isTrue(Assert.java:65)
    1 frame
  3. Spring Data Core
    QueryMethod.<init>
    1. org.springframework.data.repository.query.QueryMethod.<init>(QueryMethod.java:84)
    1 frame