Uploaded image for project: 'Keycloak'
  1. Keycloak
  2. KEYCLOAK-11191

JDBC Exception when creating resources from users in external LDAP

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate Issue
    • 4.5.0.Final
    • None
    • Storage
    • None
    • Hide

      1. Add a user federation provider (AD for example) and uncheck "Import Users"
      2. Using a LDAP user, create a user resource for example with the java api "authzClient.protection().resource().create(resource)". When users are not imported, the userId is of the form: f:LdapId:User where LdapId is already a string of 36 chars length.

      The creation then fails with the following exception:
      13:14:49,448 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-9) SQL Error: 22001, SQLState: 22001
      13:14:49,448 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-9) Value too long for column "OWNER VARCHAR(36) NOT NULL": "'f:1f3c01b4-62a2-46af-a459-04dd1915dfe2:SomeOne' (47)"; SQL statement:
      insert into RESOURCE_SERVER_RESOURCE (DISPLAY_NAME, ICON_URI, NAME, OWNER, OWNER_MANAGED_ACCESS, RESOURCE_SERVER_ID, TYPE, ID) values (?, ?, ?, ?, ?, ?, ?, ?) [22001-193]
      13:14:49,450 INFO [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (default task-9) HHH000010: On release of batch it still contained JDBC statements
      13:14:49,456 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-9) Uncaught server error: org.keycloak.models.ModelException: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute statement
      at org.keycloak.connections.jpa.PersistenceExceptionConverter.convert(PersistenceExceptionConverter.java:61)
      at org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:51)

      Show
      1. Add a user federation provider (AD for example) and uncheck "Import Users" 2. Using a LDAP user, create a user resource for example with the java api "authzClient.protection().resource().create(resource)". When users are not imported, the userId is of the form: f:LdapId:User where LdapId is already a string of 36 chars length. The creation then fails with the following exception: 13:14:49,448 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-9) SQL Error: 22001, SQLState: 22001 13:14:49,448 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-9) Value too long for column "OWNER VARCHAR(36) NOT NULL": "'f:1f3c01b4-62a2-46af-a459-04dd1915dfe2:SomeOne' (47)"; SQL statement: insert into RESOURCE_SERVER_RESOURCE (DISPLAY_NAME, ICON_URI, NAME, OWNER, OWNER_MANAGED_ACCESS, RESOURCE_SERVER_ID, TYPE, ID) values (?, ?, ?, ?, ?, ?, ?, ?) [22001-193] 13:14:49,450 INFO [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (default task-9) HHH000010: On release of batch it still contained JDBC statements 13:14:49,456 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-9) Uncaught server error: org.keycloak.models.ModelException: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute statement at org.keycloak.connections.jpa.PersistenceExceptionConverter.convert(PersistenceExceptionConverter.java:61) at org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:51)
    • NEW
    • NEW

    Attachments

      Issue Links

        Activity

          People

            sthorger@redhat.com Stian Thorgersen
            sebastienve Sebastien Veyriere (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: