திங்., 7 அக்., 2019, பிற்பகல் 5:51 அன்று, Sebastian Laskawiec <
slaskawi(a)redhat.com> எழுதியது:
It usually happens that before metrics failure, there's a
database
connection failure. Please check your logs a bit earlier than the
stacktrace you posted.
ah yes, I found the cause:
3:31:23,238 ERROR
[org.keycloak.connections.jpa.updater.liquibase.conn.DefaultLiquibaseConnectionProvider]
(ServerService Thread Pool -- 66) Change Set
META-INF/jpa-changelog-1.3.0.xml::1.3.0::bburke@redhat.com failed.
Error: ERROR: relation "admin_event_entity" already exists [Failed
SQL: CREATE TABLE public.ADMIN_EVENT_ENTITY (ID VARCHAR(36) NOT NULL,
ADMIN_EVENT_TIME BIGINT, REALM_ID VARCHAR(255), OPERATION_TYPE
VARCHAR(255), AUTH_REALM_ID VARCHAR(255), AUTH_CLIENT_ID VARCHAR(255),
AUTH_USER_ID VARCHAR(255), IP_ADDRESS VARCHAR(255), RESOURCE_PATH
VARCHAR(2550), REPRESENTATION TEXT, ERROR VARCHAR(255))]
13:31:23,278 INFO [org.jboss.as.server] (Thread-2) WFLYSRV0220:
Server shutdown has been requested via an OS signal
So it seems, the pg_dump that I took and did a pg_restore here did not
help. The keycloak pod while coming up, is trying to create a table
while it is already there. I am not sure if this is a bug on keycloak
side or if I am misunderstanding something. The pods are ephemeral and
they could get deleted and come anytime, no ? Should this be a "CREATE
OR REPLACE TABLE admin_event_entity" or a "CREATE TABLE IF NOT EXISTS
admin_event_entity" ?
Also, there's a Docker Compose example with Postgresql:
https://github.com/keycloak/keycloak-containers/blob/master/docker-compos...
On Mon, Oct 7, 2019 at 11:03 AM Sankar P <sankar.curiosity(a)gmail.com>
wrote:
> 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
> _______________________________________________
> keycloak-user mailing list
> keycloak-user(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/keycloak-user
>
--
Sankar P
http://psankar.blogspot.com