<div dir="ltr">But, what is command for this import per server? I check Chapter 25. Export and Import, but w/o answer. </div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 21, 2015 at 3:28 PM, Stian Thorgersen <span dir="ltr">&lt;<a href="mailto:sthorger@redhat.com" target="_blank">sthorger@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You should only run import on one server. Otherwise both servers will independently try to recreate everything in the import file.</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On 21 December 2015 at 15:09, Andrej Prievalsky <span dir="ltr">&lt;<a href="mailto:ado.boj.83@gmail.com" target="_blank">ado.boj.83@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">My environment: keycloak-demo-1.7.0.Final running in domain mode with main server group: server-one and server-two<div>OracleLinux 7 (Java version <span style="color:rgb(51,51,51);font-family:&#39;Open Sans&#39;,Helvetica,Arial,sans-serif;font-size:12px;line-height:20px;background-color:rgb(245,245,245)">1.8.0_45</span>) machine connect with <span style="color:rgb(51,51,51);font-family:&#39;Open Sans&#39;,Helvetica,Arial,sans-serif;font-size:12px;line-height:20px">Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options</span></div><div><span style="color:rgb(51,51,51);font-family:&#39;Open Sans&#39;,Helvetica,Arial,sans-serif;font-size:12px;line-height:20px">and </span><span style="color:rgb(51,51,51);font-family:&#39;Open Sans&#39;,Helvetica,Arial,sans-serif;font-size:12px;line-height:20px;background-color:rgb(245,245,245)">Oracle JDBC driver 11.2.0.3.0</span></div><div><br><div><br></div><div>After import Realm during keycloak startup in console:</div><div>./domain.sh -Dkeycloak.migration.action=import -Dkeycloak.migration.provider=singleFile -Dkeycloak.migration.file=/opt/keycloak-1.7.0.Final/export_demo.json<br></div><div><br></div><div>I got only on server-two this ERROR, server-one is OK:</div><div><div><i><font size="1">[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</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.connections.jpa.PersistenceExceptionConverter.convert(PersistenceExceptionConverter.java:44)</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:34)</font></i></div><div><i><font size="1">[Server:server-two]     at com.sun.proxy.$Proxy117.flush(Unknown Source)</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.models.jpa.JpaRealmProvider.removeRealm(JpaRealmProvider.java:114)</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.models.cache.infinispan.DefaultCacheRealmProvider.removeRealm(DefaultCacheRealmProvider.java:221)</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.exportimport.util.ImportUtils.importRealm(ImportUtils.java:76)</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.exportimport.util.ImportUtils.importRealms(ImportUtils.java:45)</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.exportimport.singlefile.SingleFileImportProvider$1.runExportImportTask(SingleFileImportProvider.java:45)</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.exportimport.util.ExportImportSessionTask.run(ExportImportSessionTask.java:18)</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:264)</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.exportimport.singlefile.SingleFileImportProvider.importModel(SingleFileImportProvider.java:41)</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.exportimport.ExportImportManager.checkExportImport(ExportImportManager.java:67)</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.services.resources.KeycloakApplication.&lt;init&gt;(KeycloakApplication.java:86)</font></i></div><div><i><font size="1">[Server:server-two]     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)</font></i></div><div><i><font size="1">[Server:server-two]     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)</font></i></div><div><i><font size="1">[Server:server-two]     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)</font></i></div><div><i><font size="1">[Server:server-two]     at java.lang.reflect.Constructor.newInstance(Constructor.java:422)</font></i></div><div><i><font size="1">[Server:server-two]     at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:148)</font></i></div><div><i><font size="1">[Server:server-two]     at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2211)</font></i></div><div><i><font size="1">[Server:server-two]     at org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:295)</font></i></div><div><i><font size="1">[Server:server-two]     at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:236)</font></i></div><div><i><font size="1">[Server:server-two]     at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112)</font></i></div><div><i><font size="1">[Server:server-two]     at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)</font></i></div><div><i><font size="1">[Server:server-two]     at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)</font></i></div><div><i><font size="1">[Server:server-two]     at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)</font></i></div><div><i><font size="1">[Server:server-two]     at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)</font></i></div><div><i><font size="1">[Server:server-two]     at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:230)</font></i></div><div><i><font size="1">[Server:server-two]     at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:131)</font></i></div><div><i><font size="1">[Server:server-two]     at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:511)</font></i></div><div><i><font size="1">[Server:server-two]     at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)</font></i></div><div><i><font size="1">[Server:server-two]     at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)</font></i></div><div><i><font size="1">[Server:server-two]     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)</font></i></div><div><i><font size="1">[Server:server-two]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)</font></i></div><div><i><font size="1">[Server:server-two]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)</font></i></div><div><i><font size="1">[Server:server-two]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)</font></i></div><div><i><font size="1">[Server:server-two]     at java.lang.Thread.run(Thread.java:745)</font></i></div><div><i><font size="1">[Server:server-two]     at org.jboss.threads.JBossThread.run(JBossThread.java:320)</font></i></div><div><i><font size="1">[Server:server-two] Caused by: javax.persistence.OptimisticLockException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.jpa.spi.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:1800)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1705)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1683)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1338)</font></i></div><div><i><font size="1">[Server:server-two]     at sun.reflect.GeneratedMethodAccessor278.invoke(Unknown Source)</font></i></div><div><i><font size="1">[Server:server-two]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)</font></i></div><div><i><font size="1">[Server:server-two]     at java.lang.reflect.Method.invoke(Method.java:497)</font></i></div><div><i><font size="1">[Server:server-two]     at org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:32)</font></i></div><div><i><font size="1">[Server:server-two]     ... 35 more</font></i></div><div><i><font size="1">[Server:server-two] Caused by: org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:81)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:73)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:63)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3400)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3630)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:114)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:465)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:351)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1258)</font></i></div><div><i><font size="1">[Server:server-two]     at org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1335)</font></i></div><div><i><font size="1">[Server:server-two]     ... 39 more</font></i></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div>
<br></div></div>_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br></blockquote></div><br></div>
</blockquote></div><br></div>