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