Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not create realm unknown_error #87

Open
619008336 opened this issue Nov 1, 2023 · 2 comments
Open

Could not create realm unknown_error #87

619008336 opened this issue Nov 1, 2023 · 2 comments

Comments

@619008336
Copy link

你好,我在keycloak22.0.4中能正常使用插件收到短信验证码,但是创建领域会Could not create realm unknown_error
2023-11-01 14:56:04,536 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-4) Uncaught server error: org.keycloak.component.ComponentValidationException: Failed to generate certificate
at org.keycloak.keys.AbstractGeneratedRsaKeyProviderFactory.generateCertificate(AbstractGeneratedRsaKeyProviderFactory.java:125)
at org.keycloak.keys.AbstractGeneratedRsaKeyProviderFactory.generateKeys(AbstractGeneratedRsaKeyProviderFactory.java:113)
at org.keycloak.keys.AbstractGeneratedRsaKeyProviderFactory.validateConfiguration(AbstractGeneratedRsaKeyProviderFactory.java:86)
at org.keycloak.models.jpa.RealmAdapter.importComponentModel(RealmAdapter.java:2006)
at org.keycloak.models.jpa.RealmAdapter.addComponentModel(RealmAdapter.java:1986)
at org.keycloak.models.utils.DefaultKeyProviders.createRsaKeyProvider(DefaultKeyProviders.java:62)
at org.keycloak.models.utils.DefaultKeyProviders.createProviders(DefaultKeyProviders.java:39)
at org.keycloak.storage.datastore.LegacyExportImportManager.importRealm(LegacyExportImportManager.java:455)
at org.keycloak.models.utils.RepresentationToModel.importRealm(RepresentationToModel.java:127)
at org.keycloak.services.managers.RealmManager.importRealm(RealmManager.java:571)
at org.keycloak.services.managers.RealmManager.importRealm(RealmManager.java:504)
at org.keycloak.services.managers.RealmManagerProviderFactory.lambda$postInit$0(RealmManagerProviderFactory.java:54)
at org.keycloak.services.DefaultKeycloakSessionFactory.publish(DefaultKeycloakSessionFactory.java:91)
at org.keycloak.storage.ImportRealmFromRepresentationEvent.fire(ImportRealmFromRepresentationEvent.java:50)
at org.keycloak.storage.datastore.LegacyExportImportManager.importRealm(LegacyExportImportManager.java:160)
at org.keycloak.services.resources.admin.RealmsAdminResource.importRealm(RealmsAdminResource.java:143)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:118)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:560)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:452)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:413)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:415)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:378)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:174)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:131)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:33)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:429)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:240)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:154)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:157)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:229)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:82)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:147)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.handle(VertxRequestHandler.java:84)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.handle(VertxRequestHandler.java:44)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1284)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:177)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:141)
at io.quarkus.vertx.http.runtime.options.HttpServerCommonHandlers$1.handle(HttpServerCommonHandlers.java:58)
at io.quarkus.vertx.http.runtime.options.HttpServerCommonHandlers$1.handle(HttpServerCommonHandlers.java:36)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1284)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:177)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:141)
at org.keycloak.quarkus.runtime.integration.web.QuarkusRequestFilter.lambda$createBlockingHandler$0(QuarkusRequestFilter.java:82)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NoSuchFieldError: id_alg_zlibCompress
at org.bouncycastle.asn1.cms.CMSObjectIdentifiers.(Unknown Source)
at org.bouncycastle.operator.DefaultSignatureNameFinder.(Unknown Source)
at org.bouncycastle.operator.jcajce.OperatorHelper.(Unknown Source)
at org.bouncycastle.operator.jcajce.JcaContentSignerBuilder.(Unknown Source)
at org.keycloak.crypto.def.BCCertificateUtilsProvider.createSigner(BCCertificateUtilsProvider.java:185)
at org.keycloak.crypto.def.BCCertificateUtilsProvider.generateV1SelfSignedCertificate(BCCertificateUtilsProvider.java:168)
at org.keycloak.crypto.def.BCCertificateUtilsProvider.generateV1SelfSignedCertificate(BCCertificateUtilsProvider.java:154)
at org.keycloak.common.util.CertificateUtils.generateV1SelfSignedCertificate(CertificateUtils.java:63)
at org.keycloak.keys.AbstractGeneratedRsaKeyProviderFactory.generateCertificate(AbstractGeneratedRsaKeyProviderFactory.java:118)
... 56 more

2023-11-01 14:56:20,758 WARN [org.keycloak.keys.GeneratedRsaKeyProviderFactory] (executor-thread-4) Failed to generate certificate for key provider 'rsa-generated' in realm 'demo'. Details: Could not initialize class org.bouncycastle.operator.jcajce.OperatorHelper
2023-11-01 14:56:20,758 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-4) Uncaught server error: org.keycloak.component.ComponentValidationException: Failed to generate certificate
at org.keycloak.keys.AbstractGeneratedRsaKeyProviderFactory.generateCertificate(AbstractGeneratedRsaKeyProviderFactory.java:125)
at org.keycloak.keys.AbstractGeneratedRsaKeyProviderFactory.generateKeys(AbstractGeneratedRsaKeyProviderFactory.java:113)
at org.keycloak.keys.AbstractGeneratedRsaKeyProviderFactory.validateConfiguration(AbstractGeneratedRsaKeyProviderFactory.java:86)
at org.keycloak.models.jpa.RealmAdapter.importComponentModel(RealmAdapter.java:2006)
at org.keycloak.models.jpa.RealmAdapter.addComponentModel(RealmAdapter.java:1986)
at org.keycloak.models.utils.DefaultKeyProviders.createRsaKeyProvider(DefaultKeyProviders.java:62)
at org.keycloak.models.utils.DefaultKeyProviders.createProviders(DefaultKeyProviders.java:39)
at org.keycloak.storage.datastore.LegacyExportImportManager.importRealm(LegacyExportImportManager.java:455)
at org.keycloak.models.utils.RepresentationToModel.importRealm(RepresentationToModel.java:127)
at org.keycloak.services.managers.RealmManager.importRealm(RealmManager.java:571)
at org.keycloak.services.managers.RealmManager.importRealm(RealmManager.java:504)
at org.keycloak.services.managers.RealmManagerProviderFactory.lambda$postInit$0(RealmManagerProviderFactory.java:54)
at org.keycloak.services.DefaultKeycloakSessionFactory.publish(DefaultKeycloakSessionFactory.java:91)
at org.keycloak.storage.ImportRealmFromRepresentationEvent.fire(ImportRealmFromRepresentationEvent.java:50)
at org.keycloak.storage.datastore.LegacyExportImportManager.importRealm(LegacyExportImportManager.java:160)
at org.keycloak.services.resources.admin.RealmsAdminResource.importRealm(RealmsAdminResource.java:143)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:118)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:560)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:452)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:413)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:415)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:378)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:174)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:131)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:33)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:429)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:240)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:154)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:157)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:229)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:82)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:147)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.handle(VertxRequestHandler.java:84)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.handle(VertxRequestHandler.java:44)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1284)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:177)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:141)
at io.quarkus.vertx.http.runtime.options.HttpServerCommonHandlers$1.handle(HttpServerCommonHandlers.java:58)
at io.quarkus.vertx.http.runtime.options.HttpServerCommonHandlers$1.handle(HttpServerCommonHandlers.java:36)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1284)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:177)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:141)
at org.keycloak.quarkus.runtime.integration.web.QuarkusRequestFilter.lambda$createBlockingHandler$0(QuarkusRequestFilter.java:82)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.bouncycastle.operator.jcajce.OperatorHelper
at org.bouncycastle.operator.jcajce.JcaContentSignerBuilder.(Unknown Source)
at org.keycloak.crypto.def.BCCertificateUtilsProvider.createSigner(BCCertificateUtilsProvider.java:185)
at org.keycloak.crypto.def.BCCertificateUtilsProvider.generateV1SelfSignedCertificate(BCCertificateUtilsProvider.java:168)
at org.keycloak.crypto.def.BCCertificateUtilsProvider.generateV1SelfSignedCertificate(BCCertificateUtilsProvider.java:154)
at org.keycloak.common.util.CertificateUtils.generateV1SelfSignedCertificate(CertificateUtils.java:63)
at org.keycloak.keys.AbstractGeneratedRsaKeyProviderFactory.generateCertificate(AbstractGeneratedRsaKeyProviderFactory.java:118)
... 56 more
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoSuchFieldError: id_alg_zlibCompress [in thread "executor-thread-4"]
at org.bouncycastle.asn1.cms.CMSObjectIdentifiers.(Unknown Source)
at org.bouncycastle.operator.DefaultSignatureNameFinder.(Unknown Source)
at org.bouncycastle.operator.jcajce.OperatorHelper.(Unknown Source)
... 62 more

@619008336
Copy link
Author

代码来自分支keycloak22.x.x 最后更新时间2023/10/18 0018 20:10

@Roboskeletron
Copy link

@619008336 this error is caused by aliyun provider. com.aliyun:aliyun-java-sdk-core dependency uses bouncycastle jdk15. This causes java.lang.NoSuchFieldError exception.
The possible solutions of this issues:

  • Use diffrent keycloak version
  • Dont uses this provider
  • Ovveride dependencies
  • Create your own implementation of this provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants