[keycloak-user] 1.8.1.Final SQL error

Marek Posolda mposolda at redhat.com
Wed Feb 17 02:42:02 EST 2016


Ah, good to know as here PostgreSQL works fine.

I guess your DB wasn't properly cleaned, but just partially, which is 
worst situation as DB is in inconsistent state and Keycloak can't solve 
this type of DB mess. Keycloak is supposed to handle start against empty 
DB or upgrade against DB from previous version.

Marek

On 16/02/16 22:33, Paul Blair wrote:
> This doesn't seem to have recurred. Not sure what happened there.
>
> From: <keycloak-user-bounces at lists.jboss.org 
> <mailto:keycloak-user-bounces at lists.jboss.org>> on behalf of 
> "pblair at clearme.com <mailto:pblair at clearme.com>" <pblair at clearme.com 
> <mailto:pblair at clearme.com>>
> Date: Tuesday, February 16, 2016 at 2:40 PM
> To: "keycloak-user at lists.jboss.org 
> <mailto:keycloak-user at lists.jboss.org>" <keycloak-user at lists.jboss.org 
> <mailto:keycloak-user at lists.jboss.org>>
> Subject: [keycloak-user] 1.8.1.Final SQL error
>
> I've just installed Keycloak 1.8.1.Final in a clean environment with a 
> new Postgres database instance.  I'm getting an error on startup that 
> the column direct_grants_only does not exist on the CLIENT table. When 
> I log in to the database I can confirm it's not there; otherwise the 
> tables all seem to be set up, and the CLIENT table does have 
> a direct_access_grants_enabled column. I've verified that the server 
> is running WildFly 10.0.0.Final and that all the Keycloak jars 
> under ./modules/system/layers/base/org/keycloak/keycloak-core/main are 
> 1.8.1.Final. I've diffed all the config files where we made changes 
> against older versions of Keycloak and applied them to 1.8.1.Final, 
> and nothing seems relevant.
>
> Also odd is that I have two Keycloak instances running in two separate 
> Docker containers and that I only see this error in one of them. They 
> were both created at the same time by Terraform in exactly the same way.
>
> Any idea what this might be coming from?
>
> 17:04:30,706 INFO 
>  [org.keycloak.services.resources.KeycloakApplication] (ServerService 
> Thread Pool -- 50) Load config from 
> /opt/jboss/wildfly/standalone/configuration/keycloak-server.json
> 17:04:33,048 INFO 
>  [org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider] 
> (ServerService Thread Pool -- 50) Updating database
> 17:04:43,154 ERROR 
> [org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider] 
> (ServerService Thread Pool -- 50) Change Set 
> META-INF/jpa-changelog-1.2.0.Final.xml::1.2.0.Final::keycloak failed. 
>  Error: ERROR: column "direct_grants_only" does not exist
>   Position: 59 [Failed SQL: UPDATE public.CLIENT SET 
> DIRECT_GRANTS_ONLY = FALSE WHERE DIRECT_GRANTS_ONLY is null]: 
> liquibase.exception.DatabaseException: ERROR: column 
> "direct_grants_only" does not exist
>   Position: 59 [Failed SQL: UPDATE public.CLIENT SET 
> DIRECT_GRANTS_ONLY = FALSE WHERE DIRECT_GRANTS_ONLY is null]
> at 
> liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
> at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
> at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)
> at 
> liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1247)
> at 
> liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1230)
> at liquibase.changelog.ChangeSet.execute(ChangeSet.java:548)
> at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
> at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
> at liquibase.Liquibase.update(Liquibase.java:210)
> at liquibase.Liquibase.update(Liquibase.java:190)
> at liquibase.Liquibase.update(Liquibase.java:186)
> at 
> org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider.update(LiquibaseJpaUpdaterProvider.java:84)
> at 
> org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.lazyInit(DefaultJpaConnectionProviderFactory.java:153)
> at 
> org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.create(DefaultJpaConnectionProviderFactory.java:42)
> at 
> org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.create(DefaultJpaConnectionProviderFactory.java:30)
> at 
> org.keycloak.services.DefaultKeycloakSession.getProvider(DefaultKeycloakSession.java:103)
> at 
> org.keycloak.models.jpa.JpaRealmProviderFactory.create(JpaRealmProviderFactory.java:34)
> at 
> org.keycloak.models.jpa.JpaRealmProviderFactory.create(JpaRealmProviderFactory.java:16)
> at 
> org.keycloak.services.DefaultKeycloakSession.getProvider(DefaultKeycloakSession.java:103)
> at 
> org.keycloak.models.cache.infinispan.DefaultCacheRealmProvider.getDelegate(DefaultCacheRealmProvider.java:61)
> at 
> org.keycloak.models.cache.infinispan.DefaultCacheRealmProvider.getMigrationModel(DefaultCacheRealmProvider.java:43)
> at 
> org.keycloak.migration.MigrationModelManager.migrate(MigrationModelManager.java:21)
> at 
> org.keycloak.services.resources.KeycloakApplication.migrateModel(KeycloakApplication.java:139)
> at 
> org.keycloak.services.resources.KeycloakApplication.<init>(KeycloakApplication.java:82)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
> at 
> org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:150)
> at 
> org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2209)
> at 
> org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:299)
> at 
> org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:240)
> at 
> org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:113)
> at 
> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
> at 
> io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
> at 
> org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
> at 
> io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
> at 
> io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:231)
> at 
> io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:132)
> at 
> io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:526)
> at 
> org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)
> at 
> org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> at org.jboss.threads.JBossThread.run(JBossThread.java:320)
> Caused by: org.postgresql.util.PSQLException: ERROR: column 
> "direct_grants_only" does not exist
>   Position: 59
> at 
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)
> at 
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)
> at 
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
> at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)
> at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:405)
> at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:397)
> at 
> org.jboss.jca.adapters.jdbc.WrappedStatement.execute(WrappedStatement.java:198)
> at 
> liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314)
> ... 47 more
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160217/db22b870/attachment-0001.html 


More information about the keycloak-user mailing list