Skip to content

Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "customAttributes" is null #1010

Closed
@moritzschmitz-oviva

Description

Current Behavior

I am receiving this error Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "customAttributes" is null when trying to import a realm config via keycloak-config-cli.

Error message:

Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "customAttributes" is null
  at de.adorsys.keycloak.config.service.checksum.ChecksumService.hasToBeUpdated(ChecksumService.java:64)
  at de.adorsys.keycloak.config.service.RealmImportService.updateRealmIfNecessary(RealmImportService.java:151)
  at de.adorsys.keycloak.config.service.RealmImportService.doImport(RealmImportService.java:144)
  at de.adorsys.keycloak.config.KeycloakConfigRunner.run(KeycloakConfigRunner.java:79)
  at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:768)
  ... 13 common frames omitted

Expected Behavior

Well, I was hoping at least for a more meaningful error message.

Steps To Reproduce

Get files from: https://gist.github.com/moritzschmitz-oviva/4b629a0cd88ef1962bde54ca57c64c83.

mkdir tmp
wget https://gist.github.com/moritzschmitz-oviva/4b629a0cd88ef1962bde54ca57c64c83/archive/964cfb4ea0dc3b449390a87b2eeb71992e04bf4d.zip
unzip 964cfb4ea0dc3b449390a87b2eeb71992e04bf4d.zip -d tmp
rm 964cfb4ea0dc3b449390a87b2eeb71992e04bf4d.zip
cd tmp/4b629a0cd88ef1962bde54ca57c64c83-964cfb4ea0dc3b449390a87b2eeb71992e04bf4d
mkdir -p before
mv before-some-realm.json before/some-realm.json
mkdir -p changes
mv changes-some-realm.json changes/some-realm.json
docker compose up kcc

Without using my setup, it should be reproducible like this as well:

  1. Import {"id":"test","realm":"test","attributes":{}} to Keycloak via kc.sh import.
  2. Import {"id":"test","realm":"test","displayName":"just-a-name"} to Keycloak via keycloak-config-cli.

Environment

  • Keycloak Version: 23.0.7
  • keycloak-config-cli Version: 5.12.0-23.0.7

Anything else?

My goal is to migrate an existing Keycloak installation to using keycloak-config-cli. To ensure I am not changing more or less than what we need I import the current realm config into a local instance, apply config via keycloak-config-cli and then export it again to check for unexpected differences.

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions