In case this helps...
I had a quick peek at the source - there were two issues that made Oracle choke
in my environment. First the BigDecimal issue in the custom change
JpaUpdate1_2_0_Beta1.java as initially reported. Secondly in the custom change
JpaUpdate1_2_0_CR1.java there was a prepared statement that Oracle 10 doesn't
like as it expects a boolean 'TRUE' to be represented by the numerical value
'1'.
I hacked the following two lines and that appears to fix the upgrade to
1.2.0.Final (for Oracle10 at least). The remaining liquibase scripts then ran
without issue.
best rgds,
Steve F.
diff --git
a/connections/jpa-liquibase/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/JpaUpdate1_2_0_Beta1.javab/connections/jpa-liquibase/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/JpaUpdate1_2_0_Beta1.java
index 89e7885..895a785 100644
---
a/connections/jpa-liquibase/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/JpaUpdate1_2_0_Beta1.java
+++
b/connections/jpa-liquibase/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/JpaUpdate1_2_0_Beta1.java
@@ -293,7 +293,7 @@
}
Object acmObj =
resultSet.getObject("ALLOWED_CLAIMS_MASK");
- long mask = (acmObj != null) ? (Long) acmObj : ClaimMask.ALL;
+ long mask = (acmObj != null) ? ((Number)
acmObj).longValue() : ClaimMask.ALL;
MigrationProvider migrationProvider =
this.kcSession.getProvider(MigrationProvider.class);
List<ProtocolMapperRepresentation> protocolMappers =
migrationProvider.getMappersForClaimMask(mask);
diff --git
a/connections/jpa-liquibase/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/JpaUpdate1_2_0_CR1.javab/connections/jpa-liquibase/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/JpaUpdate1_2_0_CR1.java
index 5c8a2eb..dbeedf7 100644
---
a/connections/jpa-liquibase/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/JpaUpdate1_2_0_CR1.java
+++
b/connections/jpa-liquibase/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/JpaUpdate1_2_0_CR1.java
@@ -17,7 +17,7 @@
String realmClientTableName =
database.correctObjectName("REALM_CLIENT", Table.class);
try {
- PreparedStatement statement =
jdbcConnection.prepareStatement("select CLIENT.REALM_ID, CLIENT.ID CLIENT_ID
from CLIENT where CLIENT.CONSENT_REQUIRED = true");
+ PreparedStatement statement =
jdbcConnection.prepareStatement("select CLIENT.REALM_ID, CLIENT.ID CLIENT_ID
from CLIENT where CLIENT.CONSENT_REQUIRED = 1");
try {
ResultSet resultSet = statement.executeQuery();
try {
===================================================
*Stephen Flynn*
*Director, JF Technology (UK) Ltd*
Cell (UK) : +44 7768 003 882
Phone : +44 20 7833 8346
IM : xmpp:stephen.flynn@jftechnology.com
IM : aim:stephen.flynn@jftechnology.com
Website :
http://www.jftechnology.com
Tech support : support(a)jftechnology.com <mailto:support@jftechnology.com>
===================================================
On 03/08/2015 15:53, Bill Burke wrote:
I could do a 1.4.1 when you fix it.
On 8/3/2015 10:51 AM, Marek Posolda wrote:
> Thanks for the detailed report. I've created JIRA for this and will be
> fixed for next release
https://issues.jboss.org/browse/KEYCLOAK-1725 .
>
> Marek
>
> On 2.8.2015 15:11, Bill Burke wrote:
>> You probably have to export your database to json and re-import it until
>> we track this down.
>>
>> On 8/1/2015 11:19 AM, Stephen Flynn wrote:
>>> Hi all,
>>>
>>> I'm trying to upgrade Keycloak from 1.1.0.Final to 1.4.0.Final.
>>>
>>> The liquibase db scripts are failing. The particular script that is
>>> failing is 'jpa-changelog-1.2.0.Beta1.xml' with the exception
'Caused
>>> by: java.lang.ClassCastException: java.math.BigDecimal cannot be cast to
>>> java.lang.Long'. More stack trace below.
>>>
>>> Any ideas as to why this might be happening ? Is there anything else I
>>> can provide to give more insight ?
>>>
>>> best rgds,
>>>
>>> Steve F.
>>>
>>>
>>> Environment is...
>>>
>>> * wildfly-9.0.1.Final + keycloak-overlay-1.4.0.Final
>>> * jdk1.7.0_51
>>> * Oracle 10 + odbcj6.jar (11.2.0.2.0)
>>>
>>>
>>> Liquibase change log from the DB
>>>
>>> * 1.0.0.Final sthorger(a)redhat.com
>>> META-INF/jpa-changelog-1.0.0.Final.xml 2014-12-04
>>> 00:55:28.95072 1 EXECUTED
>>> * 1.1.0.Beta1 sthorger(a)redhat.com
>>> META-INF/jpa-changelog-1.1.0.Beta1.xml 2014-12-04
>>> 00:55:30.070692 2 EXECUTED
>>> * 1.1.0.Final sthorger(a)redhat.com
>>> META-INF/jpa-changelog-1.1.0.Final.xml 2015-01-30
>>> 00:55:27.065618 3 EXECUTED
>>>
>>>
>>> Error message in log...
>>>
>>> 15:12:31,238 INFO [org.keycloak.services.resources.KeycloakApplication]
>>> (ServerService Thread Pool -- 69) Load config from
>>>
/apps/wildfly/wildfly-9.0.1.Final/standalone/configuration/keycloak-server.json
>>>
>>>
>>> 15:12:34,416 INFO
>>> [org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider]
>>>
>>> (ServerService Thread Pool -- 69) Updating database
>>> 15:12:35,982 ERROR
>>> [org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider]
>>>
>>> (ServerService Thread Pool -- 69) Change Set
>>> META-INF/jpa-changelog-1.2.0.Beta1.xml::1.2.0.Beta1::psilva@redhat.com
>>> failed. Error: liquibase.exception.CustomChangeException: Update
>>> 1.2.0.Beta1: Exception when updating data from previous version:
>>> liquibase.exception.UnexpectedLiquibaseException:
>>> liquibase.exception.CustomChangeException: Update 1.2.0.Beta1: Exception
>>> when updating data from previous version
>>> at
>>>
liquibase.change.custom.CustomChangeWrapper.generateStatements(CustomChangeWrapper.java:185)
>>>
>>>
>>> at
>>>
liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1208)
>>>
>>>
>>> at liquibase.changelog.ChangeSet.execute(ChangeSet.java:550)
>>> at
>>> liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43)
>>> at
>>> liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
>>> at liquibase.Liquibase.update(Liquibase.java:200)
>>> at liquibase.Liquibase.update(Liquibase.java:181)
>>> at
>>>
org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider.update(LiquibaseJpaUpdaterProvider.java:84)
>>>
>>>
>>> [keycloak-connections-jpa-liquibase-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.lazyInit(DefaultJpaConnectionProviderFactory.java:150)
>>>
>>>
>>> [keycloak-connections-jpa-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.create(DefaultJpaConnectionProviderFactory.java:39)
>>>
>>>
>>> [keycloak-connections-jpa-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.create(DefaultJpaConnectionProviderFactory.java:27)
>>>
>>>
>>> [keycloak-connections-jpa-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.services.DefaultKeycloakSession.getProvider(DefaultKeycloakSession.java:99)
>>>
>>>
>>> [keycloak-services-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.models.jpa.JpaRealmProviderFactory.create(JpaRealmProviderFactory.java:34)
>>>
>>>
>>> [keycloak-model-jpa-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.models.jpa.JpaRealmProviderFactory.create(JpaRealmProviderFactory.java:16)
>>>
>>>
>>> [keycloak-model-jpa-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.services.DefaultKeycloakSession.getProvider(DefaultKeycloakSession.java:99)
>>>
>>>
>>> [keycloak-services-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.models.cache.DefaultCacheRealmProvider.getDelegate(DefaultCacheRealmProvider.java:70)
>>>
>>>
>>> [keycloak-invalidation-cache-model-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.models.cache.DefaultCacheRealmProvider.getRealm(DefaultCacheRealmProvider.java:163)
>>>
>>>
>>> [keycloak-invalidation-cache-model-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.services.managers.ApplianceBootstrap.bootstrap(ApplianceBootstrap.java:40)
>>>
>>>
>>> [keycloak-services-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.services.managers.ApplianceBootstrap.bootstrap(ApplianceBootstrap.java:31)
>>>
>>>
>>> [keycloak-services-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.services.resources.KeycloakApplication.setupDefaultRealm(KeycloakApplication.java:158)
>>>
>>>
>>> [keycloak-services-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.services.resources.KeycloakApplication.<init>(KeycloakApplication.java:88)
>>>
>>>
>>> [keycloak-services-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>> [rt.jar:1.7.0_51]
>>> at
>>>
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>>>
>>>
>>> [rt.jar:1.7.0_51]
>>> at
>>>
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>>>
>>>
>>> [rt.jar:1.7.0_51]
>>> at
>>> java.lang.reflect.Constructor.newInstance(Constructor.java:526)
>>> [rt.jar:1.7.0_51]
>>> at
>>>
org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:148)
>>>
>>>
>>> [resteasy-jaxrs-3.0.11.Final.jar:]
>>> at
>>>
org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2211)
>>>
>>>
>>> [resteasy-jaxrs-3.0.11.Final.jar:]
>>> at
>>>
org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:295)
>>>
>>>
>>> [resteasy-jaxrs-3.0.11.Final.jar:]
>>> at
>>> org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:236)
>>>
>>> [resteasy-jaxrs-3.0.11.Final.jar:]
>>> at
>>>
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112)
>>>
>>>
>>> [resteasy-jaxrs-3.0.11.Final.jar:]
>>> at
>>>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
>>>
>>>
>>> [resteasy-jaxrs-3.0.11.Final.jar:]
>>> at
>>>
io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
>>>
>>>
>>> [undertow-servlet-1.2.9.Final.jar:1.2.9.Final]
>>> at
>>>
org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
>>>
>>>
>>> at
>>>
io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
>>>
>>>
>>> [undertow-servlet-1.2.9.Final.jar:1.2.9.Final]
>>> at
>>>
io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:230)
>>>
>>>
>>> [undertow-servlet-1.2.9.Final.jar:1.2.9.Final]
>>> at
>>>
io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:131)
>>>
>>> [undertow-servlet-1.2.9.Final.jar:1.2.9.Final]
>>> at
>>>
io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:511)
>>>
>>>
>>> [undertow-servlet-1.2.9.Final.jar:1.2.9.Final]
>>> 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:471)
>>> [rt.jar:1.7.0_51]
>>> at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>>> [rt.jar:1.7.0_51]
>>> at
>>>
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>>
>>>
>>> [rt.jar:1.7.0_51]
>>> at
>>>
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>>
>>>
>>> [rt.jar:1.7.0_51]
>>> at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
>>> at org.jboss.threads.JBossThread.run(JBossThread.java:320)
>>> Caused by: liquibase.exception.CustomChangeException: Update
>>> 1.2.0.Beta1: Exception when updating data from previous version
>>> at
>>>
org.keycloak.connections.jpa.updater.liquibase.custom.JpaUpdate1_2_0_Beta1.generateStatementsImpl(JpaUpdate1_2_0_Beta1.java:43)
>>>
>>>
>>> [keycloak-connections-jpa-liquibase-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.connections.jpa.updater.liquibase.custom.CustomKeycloakTask.generateStatements(CustomKeycloakTask.java:79)
>>>
>>>
>>> [keycloak-connections-jpa-liquibase-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
liquibase.change.custom.CustomChangeWrapper.generateStatements(CustomChangeWrapper.java:178)
>>>
>>>
>>> ... 44 more
>>> Caused by: java.lang.ClassCastException: java.math.BigDecimal cannot be
>>> cast to java.lang.Long
>>> at
>>>
org.keycloak.connections.jpa.updater.liquibase.custom.JpaUpdate1_2_0_Beta1.addDefaultProtocolMappers(JpaUpdate1_2_0_Beta1.java:296)
>>>
>>>
>>> [keycloak-connections-jpa-liquibase-1.4.0.Final.jar:1.4.0.Final]
>>> at
>>>
org.keycloak.connections.jpa.updater.liquibase.custom.JpaUpdate1_2_0_Beta1.generateStatementsImpl(JpaUpdate1_2_0_Beta1.java:41)
>>>
>>>
>>> [keycloak-connections-jpa-liquibase-1.4.0.Final.jar:1.4.0.Final]
>>> ... 46 more
>>>
>>> --
>>> ===================================================
>>>
>>> *Stephen Flynn*
>>>
>>> *Director, JF Technology (UK) Ltd*
>>>
>>> Cell (UK) : +44 7768 003 882
>>> Phone : +44 20 7833 8346
>>> IM : xmpp:stephen.flynn@jftechnology.com
>>> IM : aim:stephen.flynn@jftechnology.com
>>> Website :
http://www.jftechnology.com
>>> Tech support : support(a)jftechnology.com
>>> <mailto:support@jftechnology.com>
>>>
>>> ===================================================
>>>
>>>
>>>
>>> _______________________________________________
>>> keycloak-user mailing list
>>> keycloak-user(a)lists.jboss.org
>>>
https://lists.jboss.org/mailman/listinfo/keycloak-user
>>>
>