[keycloak-user] Keycloak null pointer exception on launch with a custom postgres setup

Sankar P sankar.curiosity at gmail.com
Mon Oct 7 05:01:06 EDT 2019


Hi

I am getting the following NullPointerException when Keycloak is getting
launched.

A few points about the setup. I have installed keycloak, say k1, in one
machine with postgres, say pg1 as the config store. Then I created a custom
realm, some users, client scope in that setup. Then I took a dump of the
postgres setup via:

```
kubectl exec nordic-mole-postgresql-0 -- bash -c "PGPASSWORD=pguser pg_dump
-U pguser -d pgdb " > db.sql
```

Now I used the postgres dump thus obtained to build another postgres docker
image, say `pg2`

```
FROM library/postgres:11.3
ENV POSTGRES_USER pguser
ENV POSTGRES_PASSWORD pguser
ENV POSTGRES_DB pgdb
COPY  db.sql /docker-entrypoint-initdb.d/
```

Now I brought up a fresh version of keycloak, say k2, which talks to this
new pg2 postgres instance via the following command.

```
helm install codecentric/keycloak -f values.yaml
```

The values.yaml contains connection details for the 2nd database:
```
keycloak:
  persistence:
    deployPostgres: false
    dbVendor: postgres
    dbName: pgdb
    dbHost: postgres # Resolved through k8s service
    dbPort: 5432
    dbUser: pguser
    dbPassword: "pguser"
```

Now I have two questions:

1) Should I report the following crash in a bug system of some kind ?
2) Is there a simpler, cleaner way of creating a new realm, new user via
the `values.yaml` instead of taking dump of postgres ? Are there any good
tutorials, github projects etc. that explain this ?

Thanks.

The Stacktrace of the actual crash below:

13:34:03,343 ERROR [org.jboss.as.controller.management-operation]
(Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address:
([("subsystem" => "microprofile-metrics-smallrye")]):
java.lang.NullPointerException
at
org.wildfly.extension.microprofile.metrics.MicroProfileMetricsSubsystemAdd$2.execute(MicroProfileMetricsSubsystemAdd.java:86)
at
org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:999)
at
org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:743)
at
org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:467)
at
org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1412)
at
org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:521)
at
org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:472)
at
org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:434)
at org.jboss.as.server.ServerService.boot(ServerService.java:435)
at org.jboss.as.server.ServerService.boot(ServerService.java:394)
at
org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:374)
at java.lang.Thread.run(Thread.java:748)

-- 
Sankar P
http://psankar.blogspot.com


More information about the keycloak-user mailing list