[keycloak-user] Issue during Import of Realm via startup in domain mode

Andrej Prievalsky ado.boj.83 at gmail.com
Mon Dec 21 09:50:39 EST 2015


But, what is command for this import per server? I check Chapter 25. Export
and Import, but w/o answer.

On Mon, Dec 21, 2015 at 3:28 PM, Stian Thorgersen <sthorger at redhat.com>
wrote:

> You should only run import on one server. Otherwise both servers will
> independently try to recreate everything in the import file.
>
> On 21 December 2015 at 15:09, Andrej Prievalsky <ado.boj.83 at gmail.com>
> wrote:
>
>> My environment: keycloak-demo-1.7.0.Final running in domain mode with
>> main server group: server-one and server-two
>> OracleLinux 7 (Java version 1.8.0_45) machine connect with Oracle
>> Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With
>> the Partitioning, OLAP, Advanced Analytics and Real Application Testing
>> options
>> and Oracle JDBC driver 11.2.0.3.0
>>
>>
>> After import Realm during keycloak startup in console:
>> ./domain.sh -Dkeycloak.migration.action=import
>> -Dkeycloak.migration.provider=singleFile
>> -Dkeycloak.migration.file=/opt/keycloak-1.7.0.Final/export_demo.json
>>
>> I got only on server-two this ERROR, server-one is OK:
>> *[Server:server-two] 14:25:30,037 ERROR
>> [org.keycloak.exportimport.ExportImportManager] (ServerService Thread Pool
>> -- 64) Error during export/import: org.keycloak.models.ModelException:
>> javax.persistence.OptimisticLockException: Batch update returned unexpected
>> row count from update [0]; actual row count: 0; expected: 1*
>> *[Server:server-two]     at
>> org.keycloak.connections.jpa.PersistenceExceptionConverter.convert(PersistenceExceptionConverter.java:44)*
>> *[Server:server-two]     at
>> org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:34)*
>> *[Server:server-two]     at com.sun.proxy.$Proxy117.flush(Unknown Source)*
>> *[Server:server-two]     at
>> org.keycloak.models.jpa.JpaRealmProvider.removeRealm(JpaRealmProvider.java:114)*
>> *[Server:server-two]     at
>> org.keycloak.models.cache.infinispan.DefaultCacheRealmProvider.removeRealm(DefaultCacheRealmProvider.java:221)*
>> *[Server:server-two]     at
>> org.keycloak.exportimport.util.ImportUtils.importRealm(ImportUtils.java:76)*
>> *[Server:server-two]     at
>> org.keycloak.exportimport.util.ImportUtils.importRealms(ImportUtils.java:45)*
>> *[Server:server-two]     at
>> org.keycloak.exportimport.singlefile.SingleFileImportProvider$1.runExportImportTask(SingleFileImportProvider.java:45)*
>> *[Server:server-two]     at
>> org.keycloak.exportimport.util.ExportImportSessionTask.run(ExportImportSessionTask.java:18)*
>> *[Server:server-two]     at
>> org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:264)*
>> *[Server:server-two]     at
>> org.keycloak.exportimport.singlefile.SingleFileImportProvider.importModel(SingleFileImportProvider.java:41)*
>> *[Server:server-two]     at
>> org.keycloak.exportimport.ExportImportManager.checkExportImport(ExportImportManager.java:67)*
>> *[Server:server-two]     at
>> org.keycloak.services.resources.KeycloakApplication.<init>(KeycloakApplication.java:86)*
>> *[Server:server-two]     at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)*
>> *[Server:server-two]     at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)*
>> *[Server:server-two]     at
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)*
>> *[Server:server-two]     at
>> java.lang.reflect.Constructor.newInstance(Constructor.java:422)*
>> *[Server:server-two]     at
>> org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:148)*
>> *[Server:server-two]     at
>> org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2211)*
>> *[Server:server-two]     at
>> org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:295)*
>> *[Server:server-two]     at
>> org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:236)*
>> *[Server:server-two]     at
>> org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112)*
>> *[Server:server-two]     at
>> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)*
>> *[Server:server-two]     at
>> io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)*
>> *[Server:server-two]     at
>> org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)*
>> *[Server:server-two]     at
>> io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)*
>> *[Server:server-two]     at
>> io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:230)*
>> *[Server:server-two]     at
>> io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:131)*
>> *[Server:server-two]     at
>> io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:511)*
>> *[Server:server-two]     at
>> org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)*
>> *[Server:server-two]     at
>> org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)*
>> *[Server:server-two]     at
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)*
>> *[Server:server-two]     at
>> java.util.concurrent.FutureTask.run(FutureTask.java:266)*
>> *[Server:server-two]     at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)*
>> *[Server:server-two]     at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)*
>> *[Server:server-two]     at java.lang.Thread.run(Thread.java:745)*
>> *[Server:server-two]     at
>> org.jboss.threads.JBossThread.run(JBossThread.java:320)*
>> *[Server:server-two] Caused by:
>> javax.persistence.OptimisticLockException: Batch update returned unexpected
>> row count from update [0]; actual row count: 0; expected: 1*
>> *[Server:server-two]     at
>> org.hibernate.jpa.spi.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:1800)*
>> *[Server:server-two]     at
>> org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1705)*
>> *[Server:server-two]     at
>> org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677)*
>> *[Server:server-two]     at
>> org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1683)*
>> *[Server:server-two]     at
>> org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1338)*
>> *[Server:server-two]     at
>> sun.reflect.GeneratedMethodAccessor278.invoke(Unknown Source)*
>> *[Server:server-two]     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)*
>> *[Server:server-two]     at
>> java.lang.reflect.Method.invoke(Method.java:497)*
>> *[Server:server-two]     at
>> org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:32)*
>> *[Server:server-two]     ... 35 more*
>> *[Server:server-two] Caused by: org.hibernate.StaleStateException: Batch
>> update returned unexpected row count from update [0]; actual row count: 0;
>> expected: 1*
>> *[Server:server-two]     at
>> org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:81)*
>> *[Server:server-two]     at
>> org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:73)*
>> *[Server:server-two]     at
>> org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:63)*
>> *[Server:server-two]     at
>> org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3400)*
>> *[Server:server-two]     at
>> org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3630)*
>> *[Server:server-two]     at
>> org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:114)*
>> *[Server:server-two]     at
>> org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:465)*
>> *[Server:server-two]     at
>> org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:351)*
>> *[Server:server-two]     at
>> org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350)*
>> *[Server:server-two]     at
>> org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56)*
>> *[Server:server-two]     at
>> org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1258)*
>> *[Server:server-two]     at
>> org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1335)*
>> *[Server:server-two]     ... 39 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/20151221/0de346a6/attachment-0001.html 


More information about the keycloak-user mailing list