-
Bug
-
Resolution: Done
-
Major
-
1.0.2.Final
-
None
-
None
Since the change on Jan 22th, I'm no longer able to provision the keycloak database with the apiman-realm.json available on github on master.
https://raw.githubusercontent.com/apiman/apiman/master/distro/data/src/main/resources/data/apiman-realm.json
In the apiman-demos I'm provisioning a standalone keycloak server with:
RUN cd $JBOSS_HOME && curl https://raw.githubusercontent.com/apiman/apiman/master/distro/data/src/main/resources/data/apiman-realm.json -o apiman-realm.json \ && echo 'JAVA_OPTS="$JAVA_OPTS -Dkeycloak.import=$JBOSS_HOME/apiman-realm.json"' >> /opt/jboss/wildfly/bin/standalone.conf \ && sed -i -e 's/\/apiman/http:\/\/localhost:8080\/apiman/g' $JBOSS_HOME/apiman-realm.json \ && rm -rf $JBOSS_HOME/standalone/data
So this means, removing provided H2 database an provisioning with the apiman-realm.json from master, but changing references to the apiman server (in the demos are in separate ports).
The error that I get is:
08:43:33,433 INFO [org.keycloak.services.managers.ApplianceBootstrap] (MSC service thread 1-5) Initializing master realm 08:43:34,585 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (MSC service thread 1-5) SQL Error: 23505, SQLState: 23505 08:43:34,585 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (MSC service thread 1-5) Unique index or primary key violation: "UK_DYKN684SL8UP1CRFEI6ECKHD7_INDEX_F ON PUBLIC.USER_ENTITY(REALM_ID, EMAIL_CONSTRAINT) VALUES ( /* key:5 */ null, null, 'admin@admin.com', null, null, null, null, null, '4aa5e16f-1bfa-4dd9-9963-023ecca61730', null, null)"; SQL statement: update USER_ENTITY set EMAIL=?, EMAIL_CONSTRAINT=?, EMAIL_VERIFIED=?, ENABLED=?, federation_link=?, FIRST_NAME=?, LAST_NAME=?, REALM_ID=?, TOTP=?, USERNAME=? where ID=? [23505-173] 08:43:34,588 INFO [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (MSC service thread 1-5) HHH000010: On release of batch it still contained JDBC statements 08:43:34,620 WARN [org.keycloak.services.resources.KeycloakApplication] (MSC service thread 1-5) Unable to import realm apiman from file /opt/jboss/keycloak/apiman-realm.json. Cause: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement 08:43:33,433 INFO [org.keycloak.services.managers.ApplianceBootstrap] (MSC service thread 1-5) Initializing master realm 08:43:34,585 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (MSC service thread 1-5) SQL Error: 23505, SQLState: 23505 08:43:34,585 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (MSC service thread 1-5) Unique index or primary key violation: "UK_DYKN684SL8UP1CRFEI6ECKHD7_INDEX_F ON PUBLIC.USER_ENTITY(REALM_ID, EMAIL_CONSTRAINT) VALUES ( /* key:5 */ null, null, 'admin@admin.com', null, null, null, null, null, '4aa5e16f-1bfa-4dd9-9963-023ecca61730', null, null)"; SQL statement: update USER_ENTITY set EMAIL=?, EMAIL_CONSTRAINT=?, EMAIL_VERIFIED=?, ENABLED=?, federation_link=?, FIRST_NAME=?, LAST_NAME=?, REALM_ID=?, TOTP=?, USERNAME=? where ID=? [23505-173] 08:43:34,588 INFO [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (MSC service thread 1-5) HHH000010: On release of batch it still contained JDBC statements 08:43:34,620 WARN [org.keycloak.services.resources.KeycloakApplication] (MSC service thread 1-5) Unable to import realm apiman from file /opt/jboss/keycloak/apiman-realm.json. Cause: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
This bug is related to https://issues.jboss.org/browse/APIMAN-265
- relates to
-
APIMAN-265 Configure keycloak on startup instead of providing a H2 database
- Open