我已成功将 SPI 部署到使用 smallrye-graphql-client 的 keycloak 12 (wildfly 21)。现在我升级到 keycloak 13 并且我的 spi 不再工作,因为使用的 wildfly 23 是不包含 microprofile 扩展的流式下载版本。
我认为有两种方法可以通过将所有缺少的模块文件添加到我的依赖项来解决问题。
(以下更新信息)
额外的信息
目前我收到以下错误
22:34:00,400 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-1) Uncaught server error: java.lang.NoClassDefFoundError: org.eclipse.microprofile.config.ConfigProvider
at io.smallrye.graphql.client.typesafe.impl.HeaderBuilder.<clinit>(HeaderBuilder.java:116)
at io.smallrye.graphql.client.typesafe.impl.GraphQlClientProxy.invoke(GraphQlClientProxy.java:51)
at io.smallrye.graphql.client.typesafe.impl.GraphQlClientBuilderImpl.lambda$build$0(GraphQlClientBuilderImpl.java:59)
at io.smallrye.graphql.client.typesafe.impl.GraphQlClientBuilderImpl$$Lambda$1633/0x0000000000000000.invoke(Unknown Source)
at com.sun.proxy.$Proxy109.createOrUpdateProfileWithVerifiedPersonalInformation(Unknown Source)
at fi.hel.my-plugin.utils.ProfiiliGraphQLClient.sendSuomiFiData(ProfiiliGraphQLClient.java:39)
at fi.hel.my-plugin.utils.SessionNoteTransferService.transferSuomiFiNotes(SessionNoteTransferService.java:27)
我的 build.gradle 有
dependencies {
dependenciesToInclude "io.smallrye:smallrye-graphql-client:1.0.20"
implementation "org.apache.geronimo.config:geronimo-config-impl:1.2.2"
compileOnly 'org.projectlombok:lombok:1.18.16'
annotationProcessor 'org.projectlombok:lombok:1.18.16'
providedCompile "javax.enterprise:cdi-api:2.0"
providedCompile "org.keycloak:keycloak-server-spi:${keycloakVersion}"
providedCompile "org.keycloak:keycloak-server-spi-private:${keycloakVersion}"
providedCompile("org.keycloak:keycloak-services:${keycloakVersion}") {
exclude group: 'org.slf4j', module: 'slf4j-api'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
providedCompile "org.keycloak:keycloak-model-api:1.8.1.Final"
providedCompile "org.eclipse.microprofile.graphql:microprofile-graphql-api:1.0.3"
configurations.compile.extendsFrom(configurations.dependenciesToInclude)
providedCompile("org.keycloak:keycloak-saml-core-public:${keycloakVersion}") {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
providedCompile "org.slf4j:slf4j-api:1.7.30"
}
当我尝试将模块添加到我的项目时,出现以下错误
22:25:47,062 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "my-plugins-0.10.0.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"my-plugins-0.10.0.ear\".WeldStartService" => "Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException
Caused by: javax.enterprise.event.ObserverException
Caused by: java.lang.NoClassDefFoundError: Failed to link org/jboss/resteasy/microprofile/config/ServletConfigSource (Module \"org.jboss.resteasy.resteasy-jaxrs\" version 3.15.1.Final from local module loader @38bc2d60 (finder: local module finder @1cd3c9cd (roots: /Users/xxx/keycloak/standalone/keycloak-13.0.0/modules,/Users/xxx/keycloak/standalone/keycloak-13.0.0/modules/system/layers/keycloak,/Users/xxx/keycloak/standalone/keycloak-13.0.0/modules/system/layers/base))): org.eclipse.microprofile.config.spi.ConfigSource"}}
我已经通过以下方式修改了 dependenciesToInclude :
dependenciesToInclude "io.smallrye:smallrye-graphql-client:1.0.20",
"io.smallrye.config:smallrye-config:2.3.0",
"org.jboss.resteasy:resteasy-client:4.6.0.Final",
"org.wildfly:wildfly-microprofile-config-smallrye:23.0.2.Final",
"org.wildfly:wildfly-microprofile-openapi-smallrye:23.0.2.Final",
"io.smallrye:smallrye-open-api-jaxrs:2.1.4",
"org.owasp.encoder:encoder:1.2.3"
我还发现,如果扩展程序已经发布但已停用,我可以将它与命令一起使用
[standalone@localhost:9990 /] /extension=org.wildfly.extension.microprofile.openapi-smallrye:add()
{"outcome" => "success"}
5月18日编辑
我已经进一步调查了这个问题,似乎问题在于我缺少微配置文件配置:
通过拥有这两个包:"io.smallrye.config:smallrye-config:2.3.0", "io.smallrye:smallrye-graphql-client:1.0.20"
我收到以下错误:
Caused by: java.lang.NoClassDefFoundError: Failed to link org/jboss/resteasy/microprofile/config/ServletConfigSource (Module "org.jboss.resteasy.resteasy-jaxrs" version 3.15.1.Final from local module loader @79c75956 (finder: local module finder @f0d5fb02 (roots: /Users/xxx/keycloak/standalone/keycloak-13.0.0/modules,/Users/xxx/keycloak/standalone/keycloak-13.0.0/modules/system/layers/keycloak,/Users/xxx/keycloak/standalone/keycloak-13.0.0/modules/system/layers/base))): org.eclipse.microprofile.config.spi.ConfigSource
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClassInternal(ClassLoader.java:398)
at java.lang.ClassLoader.defineClass(ClassLoader.java:359)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:555)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:339)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:126)
at org.jboss.modules.Module.loadModuleClass(Module.java:753)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:247)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:408)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at io.smallrye.config.SmallRyeConfigBuilder.discoverSources(SmallRyeConfigBuilder.java:95)
at io.smallrye.config.SmallRyeConfig.buildConfigSources(SmallRyeConfig.java:76)
at io.smallrye.config.SmallRyeConfig.<init>(SmallRyeConfig.java:68)
at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:402)
at io.smallrye.config.SmallRyeConfigFactory$Default.getConfigFor(SmallRyeConfigFactory.java:59)
at io.smallrye.config.SmallRyeConfigProviderResolver.getConfig(SmallRyeConfigProviderResolver.java:76)
at org.eclipse.microprofile.config.ConfigProvider.getConfig(ConfigProvider.java:101)
at io.smallrye.config.inject.ConfigExtension.validate(ConfigExtension.java:146)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
... 26 more
我注意到at io.smallrye.config.SmallRyeConfigBuilder.discoverSources(SmallRyeConfigBuilder.java:95)
有 0 个已发现的来源。但是,我不知道如何添加它们。
我尝试添加没有帮助的 META-INF/microprofile-config.properties。