[keycloak-dev] Testing Migration?

Stian Thorgersen sthorger at redhat.com
Thu Oct 1 03:05:01 EDT 2015


There was a problem with the database not being updated from 1.5 to 1.6 as
the latest version was still set to 1.5. Fix on its way:
https://github.com/keycloak/keycloak/pull/1666

On 1 October 2015 at 01:53, Stan Silvert <ssilvert at redhat.com> wrote:

> I've never tested migration before and I wonder if I'm doing it right.
> Keycloak 1.6 server dies before the migration code is ever executed.
> Here is what I did:
>
> Download Keycloak 1.5
> Start the server, add a couple of users and a new realm.
> Build Keycloak 1.6
> Copy the database from 1.5 to 1.6
> Start Keycloak 1.6
>
> I get:
>
> 19:40:03,411 INFO  [org.hibernate.Version] (ServerService Thread Pool --
> 61) HHH000412: Hibernate Core {4.3.10.Final}
> 19:40:03,413 INFO  [org.hibernate.cfg.Environment] (ServerService Thread
> Pool -- 61) HHH000206: hibernate.properties not found
> 19:40:03,414 INFO  [org.hibernate.cfg.Environment] (ServerService Thread
> Pool -- 61) HHH000021: Bytecode provider name : javassist
> 19:40:03,511 INFO  [org.hibernate.annotations.common.Version]
> (ServerService Thread Pool -- 61) HCANN000001: Hibernate Commons
> Annotations {4.0.5.Final}
> 19:40:03,551 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread
> Pool -- 61) HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
> 19:40:03,556 WARN  [org.hibernate.dialect.H2Dialect] (ServerService
> Thread Pool -- 61) HHH000431: Unable to determine H2 database version,
> certain features may not work
> 19:40:03,761 INFO
> [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory]
> (ServerService Thread Pool -- 61) HHH000397: Using
> ASTQueryTranslatorFactory
> 19:40:03,789 INFO  [org.hibernate.validator.internal.util.Version]
> (ServerService Thread Pool -- 61) HV000001: Hibernate Validator 5.1.3.Final
> 19:40:04,857 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper]
> (ServerService Thread Pool -- 61) SQL Error: 42122, SQLState: 42S22
> 19:40:04,857 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper]
> (ServerService Thread Pool -- 61) Column "CLIENTENTI1_.ROOT_URL" not
> found; SQL statement:
> select realmentit0_.ID as ID1_25_0_, realmentit0_.ACCESS_CODE_LIFESPAN
> as ACCESS_C2_25_0_, realmentit0_.LOGIN_LIFESPAN as LOGIN_LI3_25_0_,
> realmentit0_.USER_ACTION_LIFESP
> AN as USER_ACT4_25_0_, realmentit0_.ACCESS_TOKEN_LIFESPAN as
> ACCESS_T5_25_0_, realmentit0_.ACCOUNT_THEME as ACCOUNT_6_25_0_,
> realmentit0_.ADMIN_EVENTS_DETAILS_ENABLED as
> ADMIN_EV7_25_0_, realmentit0_.ADMIN_EVENTS_ENABLED as ADMIN_EV8_25_0_,
> realmentit0_.ADMIN_THEME as ADMIN_TH9_25_0_, realmentit0_.BROWSER_FLOW
> as BROWSER10_25_0_, realment
> it0_.CERTIFICATE as CERTIFI11_25_0_, realmentit0_.CLIENT_AUTH_FLOW as
> CLIENT_12_25_0_, realmentit0_.CODE_SECRET as CODE_SE13_25_0_,
> realmentit0_.DEFAULT_LOCALE as DEFAULT
> ... long SQL blah blah blah ...
> 19:40:04,911 INFO
> [org.hibernate.event.internal.DefaultLoadEventListener] (ServerService
> Thread Pool -- 61) HHH000327: Error performing load command :
> org.hibernate.exception.SQLGrammarException: could not prepare statement
> 19:40:04,913 ERROR [org.jboss.msc.service.fail] (ServerService Thread
> Pool -- 61) MSC000001: Failed to start service
> jboss.undertow.deployment.default-server.default-host./auth:
> org.jboss.msc.service.StartException in service
> jboss.undertow.deployment.default-server.default-host./auth:
> java.lang.RuntimeException: Failed to construct public
>
> org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
>          at
>
> org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
>          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: java.lang.RuntimeException: Failed to construct public
>
> org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core
> .Dispatcher)
>          at
>
> org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:160)
>          at
>
> org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2211)
>          at
>
> org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:295)
>          at
>
> org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:236)
>          at
>
> org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112)
>          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:230)
>          at
>
> io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:131)
>          at
>
> io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:511)
>          at
>
> org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)
>          at
>
> org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
>          ... 6 more
> Caused by: org.keycloak.models.ModelException:
> javax.persistence.PersistenceException:
> org.hibernate.exception.SQLGrammarException: could not prepare statement
>          at
>
> org.keycloak.connections.jpa.PersistenceExceptionConverter.convert(PersistenceExceptionConverter.java:44)
>          at
>
> org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:34)
>          at com.sun.proxy.$Proxy57.find(Unknown Source)
>          at
> org.keycloak.models.jpa.JpaRealmProvider.getRealm(JpaRealmProvider.java:63)
>          at
>
> org.keycloak.models.cache.infinispan.DefaultCacheRealmProvider.getRealm(DefaultCacheRealmProvider.java:150)
>          at
>
> org.keycloak.services.managers.ApplianceBootstrap.bootstrap(ApplianceBootstrap.java:40)
>          at
>
> org.keycloak.services.managers.ApplianceBootstrap.bootstrap(ApplianceBootstrap.java:31)
>          at
>
> org.keycloak.services.resources.KeycloakApplication.setupDefaultRealm(KeycloakApplication.java:158)
>          at
>
> org.keycloak.services.resources.KeycloakApplication.<init>(KeycloakApplication.java:88)
>          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:422)
>          at
>
> org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:148)
>          ... 19 more
> Caused by: javax.persistence.PersistenceException:
> org.hibernate.exception.SQLGrammarException: could not prepare statement
>          at
>
> org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763)
>          at
>
> org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1694)
>          at
>
> org.hibernate.jpa.spi.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:1141)
>          at
>
> org.hibernate.jpa.spi.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:1068)
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>          at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>          at java.lang.reflect.Method.invoke(Method.java:497)
>          at
>
> org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:32)
>          ... 31 more
> Caused by: org.hibernate.exception.SQLGrammarException: could not
> prepare statement
>          at
>
> org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:123)
>          at
>
> org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
>          at
>
> org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126)
>          at
>
> org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:196)
>          at
>
> org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:160)
>          at
>
> org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.prepareQueryStatement(AbstractLoadPlanBasedLoader.java:257)
>          at
>
> org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeQueryStatement(AbstractLoadPlanBasedLoader.java:201)
>          at
>
> org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:137)
>          at
>
> org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:102)
>          at
>
> org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.load(AbstractLoadPlanBasedEntityLoader.java:186)
>          at
>
> org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4126)
>          at
>
> org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:503)
>          at
>
> org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:468)
>          at
>
> org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:213)
>          at
>
> org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:275)
>          at
>
> org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:151)
>          at
> org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1106)
>          at
> org.hibernate.internal.SessionImpl.access$2000(SessionImpl.java:176)
>          at
>
> org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.load(SessionImpl.java:2587)
>          at org.hibernate.internal.SessionImpl.get(SessionImpl.java:991)
>          at
>
> org.hibernate.jpa.spi.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:1110)
>          ... 37 more
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-dev/attachments/20151001/f3d1c842/attachment-0001.html 


More information about the keycloak-dev mailing list