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.53k stars 4.02k forks source link

LazyInitializationException for authorities with Elasticsearch #25763

Closed mraible closed 5 months ago

mraible commented 6 months ago
Overview of the issue

When upgrading my 21-Points Health app to JHipster 8.2.1, I noticed an error when running Cypress e2e tests.

Screenshot 2024-04-04 at 9 47 07 PM
Motivation for or Use Case

These e2e tests seem to confirm that authorities is not loaded correctly when indexing an entity that references the built-in User entity.

Reproduce the error

See https://github.com/mraible/21-points/actions/runs/8564606589/job/23471398435

Related issues

https://github.com/mraible/21-points/pull/249

Suggest a Fix
JHipster Version(s)
21-points@8.0.0-SNAPSHOT /Users/mraible/dev/21-points
├─┬ generator-jhipster-migrate@0.1.0
│ └── generator-jhipster@8.2.1 deduped
└── generator-jhipster@8.2.1
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "jwt",
    "baseName": "TwentyOnePoints",
    "blueprints": [],
    "buildTool": "gradle",
    "cacheProvider": "ehcache",
    "clientFramework": "angular",
    "clientPackageManager": "npm",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1662997089611,
    "cypressAudit": false,
    "cypressCoverage": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "devServerPort": 4200,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": true,
    "entities": [
      "Points",
      "Weight",
      "BloodPressure",
      "Preferences"
    ],
    "entitySuffix": "",
    "herokuAppName": "health-by-points",
    "herokuDeployType": "git",
    "herokuJavaVersion": "11",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "8.2.1",
    "languages": [
      "en",
      "fr"
    ],
    "lastLiquibaseTimestamp": 1667866821000,
    "messageBroker": false,
    "microfrontend": false,
    "microfrontends": [],
    "nativeLanguage": "en",
    "otherModules": [],
    "packageName": "org.jhipster.health",
    "pages": [],
    "prodDatabaseType": "postgresql",
    "reactive": false,
    "searchEngine": "elasticsearch",
    "serverPort": "8080",
    "serverSideOptions": [
      "searchEngine:elasticsearch"
    ],
    "serviceDiscoveryType": "no",
    "skipCheckLengthOfIdentifier": false,
    "skipClient": false,
    "skipFakeData": false,
    "skipUserManagement": false,
    "testFrameworks": [
      "cypress"
    ],
    "websocket": false,
    "withAdminUi": true
  }
}
Environment and Tools

openjdk version "21.0.2" 2024-01-16 OpenJDK Runtime Environment GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30) OpenJDK 64-Bit Server VM GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30, mixed mode, sharing)

git version 2.39.3 (Apple Git-146)

node: v20.12.1 npm: 10.5.0

Docker version 25.0.3, build 4debf41

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
@ChangelogDate("20221108000520")
entity Points {
  date LocalDate required
  exercise Integer
  meals Integer
  alcohol Integer
  notes String maxlength(140)
}
@ChangelogDate("20221108001452")
entity Weight {
  timestamp ZonedDateTime required
  weight Double required
}
@ChangelogDate("20221108001642")
entity BloodPressure {
  timestamp ZonedDateTime required
  systolic Integer required
  diastolic Integer required
}
@ChangelogDate("20221108002021")
entity Preferences {
  weeklyGoal Integer required min(10) max(21)
  weightUnits Units required
}
enum Units {
  KG,
  LB
}

paginate Points with pagination
paginate Weight, BloodPressure with infinite-scroll

github-actions[bot] commented 6 months ago

JHipster has completed the sample check .yo-rc.json: valid Entities JDL: valid Application: successfully generated Frontend check: success Backend check: success E2E check: success

This check uses jhipster info output from the issue description to generate the sample. Bug report that does not contain this information will be marked as invalid.

mshima commented 6 months ago

Is this fixed in 8.3.0? The stack trace is not there.

mraible commented 6 months ago

I'll check with 8.4.0 and add a comment with the results after I'm done. It might take a week or two.

mraible commented 5 months ago

This seems to be fixed in 8.4.0, so I'm closing it. CI is passing in https://github.com/mraible/21-points/pull/258.