jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.57k stars 4.02k forks source link

java.lang.IllegalStateException: No current ServletRequestAttributes #13064

Closed khalidnouh closed 3 years ago

khalidnouh commented 4 years ago

in a microservice spring boot app ,when I invoke a rest like this

   @GetMapping("/data")
    public ResponseEntity<List<ApplicantDTO>> getAllApplicants(ApplicantCriteria criteria, Pageable pageable) {
        log.debug("REST request to get Applicants by criteria: {}", criteria);
        Page<ApplicantDTO> page = applicantQueryService.findByCriteria(criteria, pageable);
        HttpHeaders headers =  PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
        return ResponseEntity.ok().headers(headers).body(page.getContent());
    }

the error occurred in generatePaginationHttpHeaders ,although it works fine in another microservice with the same configurations

pascalgrimaud commented 3 years ago

plz, provide all information in template, as we don't have any information to reproduce your issue

khalidnouh commented 3 years ago

2020-11-18 17_16_30-Greenshot in this attached image you can see a dropdownlist of ids ,it shows only 21 item (in the database i have 31 items), i don't want to increase the size , so i need a way to get the other items in this list

khalidnouh commented 3 years ago

@pascalgrimaud

pascalgrimaud commented 3 years ago

You need to use jhipster info and copy paste all information on your config.

Without this, we can't guess your config ? Is it with Angular ? React ? Is it with Cassandra ? Neo4j ? Is it Reactive or Mvc ? etc...

khalidnouh commented 3 years ago

@pascalgrimaud i using angular

JHipster Version(s)
applicant-user-management@0.0.0 D:\Aman Repos\applicant-mgmt-ms
`-- (empty)
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "microservice",
    "gitCompany": "",
    "baseName": "ApplicantUserManagement",
    "packageName": "com.isoft.applicant.um",
    "packageFolder": "com/isoft/applicant/um",
    "serverPort": 8082,
    "serviceDiscoveryType": "eureka",
    "authenticationType": "uaa",
    "uaaBaseName": "uaa",
    "cacheProvider": "no",
    "enableHibernateCache": false,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "prodDatabaseType": "postgresql",
    "searchEngine": false,
    "enableSwaggerCodegen": false,
    "messageBroker": false,
    "buildTool": "maven",
    "useSass": true,
    "clientPackageManager": "npm",
    "testFrameworks": [],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": ["ar-ly", "en"],
    "clientFramework": "angularX",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "6.7.1",
    "embeddableLaunchScript": false,
    "creationTimestamp": 1583139421728,
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "blueprints": [],
    "skipClient": true,
    "skipUserManagement": true
  },
  "git-provider": "GitHub",
  "git-company": "mamdouh87",
  "repository-name": "applicant-usermgmt-ms"
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity Applicant {
  userId Integer,
  type Integer,
  status Integer,
  category Integer,
  code String,
  centerId Integer
}
entity PersonalDetails {
  fullName String,
  mobileNo String,
  nationalId String,
  passportKey String,
  firstName String,
  middleName String,
  lastName String,
  familyName String,
  birthDate LocalDate,
  passportIssueCountry String,
  email String,
  position String
}
relationship OneToOne {
  Applicant{personalDetails} to PersonalDetails
}

dto Applicant, PersonalDetails with mapstruct
paginate Applicant, PersonalDetails with pagination
service Applicant, PersonalDetails with serviceImpl
microservice Applicant, PersonalDetails with ApplicantUserManagement
filter Applicant, PersonalDetails
clientRootFolder Applicant, PersonalDetails with applicant-mgmt-ms

Environment and Tools

java version "1.8.0_241" Java(TM) SE Runtime Environment (build 1.8.0_241-b07) Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)

git version 2.23.0.windows.1

node: v12.5.0

npm: 6.9.0

yeoman: 3.1.1

identical .jhipster\Applicant.json identical .jhipster\PersonalDetails.json INFO! Congratulations, JHipster execution is complete!

khalidnouh commented 3 years ago

@pascalgrimaud if there is any shortcut to swap between elements in the drop down list?

khalidnouh commented 3 years ago

@pascalgrimaud i need your help sir

pascalgrimaud commented 3 years ago

As you choose pagination, the findAll method return a Page. If you want to get all elements, remove the pagination, or modify your code to return a full list. But don't forget that if your table have a lot of entries (more than 1000), the selection will be painful for the end user.

I'm closing this, as there is no bug in JHipster : it's the normal behavior of generated projects with JHipster.