Uploaded image for project: 'Keycloak'
  1. Keycloak
  2. KEYCLOAK-7998

File based realm export breaks after migration from Keycloak 3.4.3 to 4.2.1

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.2.1.Final
    • Fix Version/s: 4.2.1.Final
    • Component/s: None
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      1) Start a Keycloak 3.4.3.Final instance backed by Postgresql
      2) Stop the instance and start a Keycloak 4.2.1.Final instance against the same database with export flags, e.g.:

        -Dkeycloak.migration.action=export \
        -Dkeycloak.migration.realmName=acme \
        -Dkeycloak.migration.provider=singleFile \
        -Dkeycloak.migration.file=acme-realm.json
      

      Show
      1) Start a Keycloak 3.4.3.Final instance backed by Postgresql 2) Stop the instance and start a Keycloak 4.2.1.Final instance against the same database with export flags, e.g.: -Dkeycloak.migration.action=export \ -Dkeycloak.migration.realmName=acme \ -Dkeycloak.migration.provider=singleFile \ -Dkeycloak.migration.file=acme-realm.json
    • Release Notes Text:
      Hide
      You can ignore this issue. Just noticed that I ran against the wrong database :-/.

      This is not a problem with Keycloak.
      Show
      You can ignore this issue. Just noticed that I ran against the wrong database :-/. This is not a problem with Keycloak.
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      Realm exports fails with a NullPointerException after upgrading a Keycloak 3.4.3.Final instance backed by a postgresql database to Keycloak 4.2.1.Final.

      Started Keycloak with:

         bin/standalone.sh \
         -Dkeycloak.migration.action=export \
         -Dkeycloak.migration.realmName=acme \
         -Dkeycloak.migration.provider=singleFile \
         -Dkeycloak.migration.file=acme-realm.json
      

      StackTrace:

      11:56:51,400 INFO  [org.keycloak.exportimport.singlefile.SingleFileExportProvider] (ServerService Thread Pool -- 54) Exporting realm 'acme' into file /home/tom/dev/playgroud/keycloak/keycloak-4.2.1-pg/acme-realm.json
      11:56:51,410 INFO  [org.jboss.as.server] (Thread-2) WFLYSRV0220: Server shutdown has been requested via an OS signal
      11:56:51,417 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 54) 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: RESTEASY003325: 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:84)
      	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:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      	at org.jboss.threads.JBossThread.run(JBossThread.java:320)
      Caused by: java.lang.RuntimeException: RESTEASY003325: 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:162)
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2298)
      	at org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:340)
      	at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:253)
      	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:120)
      	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:250)
      	at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:133)
      	at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:565)
      	at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:536)
      	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
      	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
      	at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      	at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:578)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81)
      	... 6 more
      Caused by: java.lang.NullPointerException
      	at org.keycloak.models.utils.ModelToRepresentation.toRepresentation(ModelToRepresentation.java:223)
      	at org.keycloak.exportimport.util.ExportUtils.exportRealm(ExportUtils.java:97)
      	at org.keycloak.exportimport.util.ExportUtils.exportRealm(ExportUtils.java:93)
      	at org.keycloak.exportimport.singlefile.SingleFileExportProvider$2.runExportImportTask(SingleFileExportProvider.java:83)
      	at org.keycloak.exportimport.util.ExportImportSessionTask.run(ExportImportSessionTask.java:35)
      	at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227)
      	at org.keycloak.exportimport.singlefile.SingleFileExportProvider.exportRealm(SingleFileExportProvider.java:78)
      	at org.keycloak.exportimport.ExportImportManager.runExport(ExportImportManager.java:105)
      	at org.keycloak.services.resources.KeycloakApplication.<init>(KeycloakApplication.java:155)
      	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:423)
      	at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:150)
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                tdarimont Thomas Darimont
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: