jhipster Keycloak 在 DEV 模式下不以 docker-compose 开头

Posted

技术标签:

【中文标题】jhipster Keycloak 在 DEV 模式下不以 docker-compose 开头【英文标题】:jhipster Keycloak doesn't start with docker-compose in DEV mode 【发布时间】:2019-03-30 00:50:48 【问题描述】:

我是 Jhipster 的新手,我使用 Keycloak 进行了尝试。 我使用 JHipster 5,阅读了 README 文件,当我在计算机上以 DEV 模式运行命令 docker-compose -f src/main/docker/keycloak.yml up 时,出现以下错误.

谁能帮帮我?

钥匙斗篷_1 | 08:07:53,713 INFO [org.hibernate.hql.internal.QueryTranslatorFactoryInitiator](ServerService 线程池 -- 60)HHH000397:使用 ASTQueryTranslatorFactory 钥匙斗篷_1 | 08:07:57,279 INFO [org.keycloak.exportimport.dir.DirImportProvider] (ServerService Thread Pool -- 60) 从目录 /opt/jboss/keycloak/realm-config 导入 钥匙斗篷_1 | 08:07:57,330 错误 [org.jboss.msc.service.fail] (ServerService 线程池 -- 60) MSC000001: 无法启动服务 jboss.undertow.deployment.default-server.default-host./auth: org. jboss.msc.service.StartException 在服务 jboss.undertow.deployment.default-server.default-host./auth: java.lang.RuntimeException: RESTEASY003325: 未能构造公共 org.keycloak.services.resources.KeycloakApplication(javax. servlet.ServletContext,org.jboss.resteasy.core.Dispatcher) 钥匙斗篷_1 |在 org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81) 钥匙斗篷_1 |在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 钥匙斗篷_1 |在 java.util.concurrent.FutureTask.run(FutureTask.java:266) 钥匙斗篷_1 |在 org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) 钥匙斗篷_1 |在 org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985) 钥匙斗篷_1 |在 org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487) 钥匙斗篷_1 |在 org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378) 钥匙斗篷_1 |在 java.lang.Thread.run(Thread.java:748) 钥匙斗篷_1 |在 org.jboss.threads.JBossThread.run(JBossThread.java:485) 钥匙斗篷_1 |原因:java.lang.RuntimeException: RESTEASY003325: 无法构造公共 org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher) 钥匙斗篷_1 |在 org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:162) 钥匙斗篷_1 |在 org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2676) 钥匙斗篷_1 |在 org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:361) 钥匙斗篷_1 |在 org.jboss.resteasy.spi.ResteasyDeployment.startInternal(ResteasyDeployment.java:274) 钥匙斗篷_1 |在 org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:86) 钥匙斗篷_1 |在 org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:119) 钥匙斗篷_1 |在 org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) 钥匙斗篷_1 |在 io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117) 钥匙斗篷_1 |在 org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78) 钥匙斗篷_1 |在 io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103) 钥匙斗篷_1 |在 io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:300) 钥匙斗篷_1 |在 io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:140) 钥匙斗篷_1 |在 io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:584) 钥匙斗篷_1 |在 io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:555) 钥匙斗篷_1 |在 io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) 钥匙斗篷_1 |在 io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) 钥匙斗篷_1 |在 org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105) 钥匙斗篷_1 |在 org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514) 钥匙斗篷_1 |在 org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514) 钥匙斗篷_1 |在 org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514) 钥匙斗篷_1 |在 org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514) 钥匙斗篷_1 |在 io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:597) 钥匙斗篷_1 |在 org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:97) 钥匙斗篷_1 |在 org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78) 钥匙斗篷_1 | ... 8 更多 钥匙斗篷_1 |引起:java.lang.NullPointerException 钥匙斗篷_1 |在 org.keycloak.exportimport.dir.DirImportProvider.getRealmsToImport(DirImportProvider.java:99) 钥匙斗篷_1 |在 org.keycloak.exportimport.dir.DirImportProvider.isMasterRealmExported(DirImportProvider.java:85) 钥匙斗篷_1 |在 org.keycloak.exportimport.ExportImportManager.isImportMasterIncluded(ExportImportManager.java:72) 钥匙斗篷_1 |在 org.keycloak.services.resources.KeycloakApplication.migrateAndBootstrap(KeycloakApplication.java:212) 钥匙斗篷_1 |在 org.keycloak.services.resources.KeycloakApplication$1.run(KeycloakApplication.java:145) 钥匙斗篷_1 |在 org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227) 钥匙斗篷_1 |在 org.keycloak.services.resources.KeycloakApplication.(KeycloakApplication.java:136) 钥匙斗篷_1 |在 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 钥匙斗篷_1 |在 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 钥匙斗篷_1 |在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 钥匙斗篷_1 |在 java.lang.reflect.Constructor.newInstance(Constructor.java:423) 钥匙斗篷_1 |在 org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:150) 钥匙斗篷_1 | ... 31 更多 钥匙斗篷_1 | 钥匙斗篷_1 | 08:07:57,391 INFO [org.jboss.as.server](线程 2)WFLYSRV0220:已通过 OS 信号请求关闭服务器 钥匙斗篷_1 | 08:07:57,531 错误 [org.jboss.as.controller.management-operation](控制器引导线程)​​WFLYCTL0013:操作(“添加”)失败 - 地址:([(“部署”=>“keycloak-server.war ")]) - 失败描述:"WFLYCTL0080: 失败的服务" => "jboss.undertow.deployment.default-server.default-host./auth" => "java.lang.RuntimeException: RESTEASY003325: 构造失败公共 org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher) 钥匙斗篷_1 |原因:java.lang.RuntimeException: RESTEASY003325: 无法构造公共 org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher) 钥匙斗篷_1 |引起:java.lang.NullPointerException" 钥匙斗篷_1 | 08:07:57,667 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport](MSC 服务线程 1-1)ISPN000080:断开 JGroups 通道 ejb

【问题讨论】:

【参考方案1】:

我自己解决了问题 CentOs7 上的默认 docker-compose 版本太旧了。 所以有两种可能:

升级 docker-compose 运行以下命令 docker run -d -v realm-config:/opt/jboss/keycloak/realm-config --env-file keycloak-env.properties -p 9080:9080 -p 9443:9443 -p 10990:10990 jboss/ 钥匙斗篷:4.5.0.Final

其中keycloak-env.properties有如下内容

KEYCLOAK_USER=管理员 KEYCLOAK_PASSWORD=管理员 DB_VENDOR=h2

【讨论】:

以上是关于jhipster Keycloak 在 DEV 模式下不以 docker-compose 开头的主要内容,如果未能解决你的问题,请参考以下文章

使用 keycloak rest admin API (Oauth2) 修改用户姓氏后 jhipster 重新加载 OIDC 令牌

使用 Keycloak SSO 在 2 个应用程序之间保持身份验证

来自带有 Spring Security (Jhispter) 的 docker 容器的 Keycloak redirect_uri

Jhipster部署到Heroku返回404

keycloak 错误 http://localhost:8080/auth/realms/claim-dev/protocol/openid-connect/token

JHipster 应用程序在开发模式下生成消息“this.driver.matchesElement”