我正在从KeyCloak 12升级到KeyCloak 26,并为此版本调整自定义提供商。在过程中,我会收到以下错误:

问题描述 投票:0回答:0
at org.jboss.resteasy.core.providerfactory.CommonProviders.processProviderContracts(CommonProviders.java:82) at org.jboss.resteasy.core.providerfactory.ClientHelper.processProviderContracts(ClientHelper.java:104) at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.processProviderContracts(ResteasyProviderFactoryImpl.java:841) at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.registerProvider(ResteasyProviderFactoryImpl.java:829) at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.registerProvider(ResteasyProviderFactoryImpl.java:816) at org.jboss.resteasy.plugins.providers.RegisterBuiltin.registerProviders(RegisterBuiltin.java:109) at org.jboss.resteasy.plugins.providers.RegisterBuiltin.register(RegisterBuiltin.java:74) at org.jboss.resteasy.plugins.providers.RegisterBuiltin.getClientInitializedResteasyProviderFactory(RegisterBuiltin.java:54) at org.jboss.resteasy.client.jaxrs.internal.ResteasyClientBuilderImpl.getProviderFactory(ResteasyClientBuilderImpl.java:357) at org.jboss.resteasy.client.jaxrs.internal.ResteasyClientBuilderImpl.build(ResteasyClientBuilderImpl.java:373) at provider.SSOGeneralFederationKCAuthorization.getToken(KCAuthorization.java:27) at provider.EventListenerProvider.asyncSearch(EventListenerProvider.java:97) at provider.EventListenerProvider.onEvent(EventListenerProvider.java:39) at org.keycloak.events.EventBuilder.sendNow(EventBuilder.java:262) at org.keycloak.events.EventBuilder.send(EventBuilder.java:249) at org.keycloak.events.EventBuilder.success(EventBuilder.java:217) at org.keycloak.authentication.forms.RegistrationUserCreation.success(RegistrationUserCreation.java:174) at org.keycloak.authentication.FormAuthenticationFlow.processAction(FormAuthenticationFlow.java:253) at org.keycloak.authentication.DefaultAuthenticationFlow.processAction(DefaultAuthenticationFlow.java:128) at org.keycloak.authentication.AuthenticationProcessor.authenticationAction(AuthenticationProcessor.java:1034) at org.keycloak.services.resources.LoginActionsService.processFlow(LoginActionsService.java:378) at org.keycloak.services.resources.LoginActionsService.processRegistration(LoginActionsService.java:747) at org.keycloak.services.resources.LoginActionsService.registerRequest(LoginActionsService.java:811) at org.keycloak.services.resources.LoginActionsService.processRegister(LoginActionsService.java:789) at org.keycloak.services.resources.LoginActionsService$quarkusrestinvoker$processRegister_7a9f3962753907b18ff9c85418d7f9feed84dedc.invoke(Unknown Source) at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29) at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141) at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147) at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:635) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521) at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11) at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:842)

导致问题的方法:
public static String getToken() {
    Keycloak keycloak = KeycloakBuilder
            .builder()
            .serverUrl(propertiesService.getProperty(URL_KEYCLOAK_SERVER))
            .realm(REALM_MASTER)
            .username(USERNAME_ADMIN)
            .password(PASSWORD_ADMIN)
            .clientId(CLIENT_ADMIN)
            .resteasyClient(new ResteasyClientBuilderImpl().connectionPoolSize(10).build())
            .build();
    return keycloak.tokenManager().getAccessTokenString();
}

pom.xml
依赖关系:

<dependency> <groupId>org.keycloak</groupId> <artifactId>keycloak-core</artifactId> <version>26.0.3</version> <exclusions> <exclusion> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-client</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.keycloak</groupId> <artifactId>keycloak-admin-client</artifactId> <version>26.0.4</version> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-client</artifactId> <version>6.2.11.Final</version> <exclusions> <exclusion> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>jakarta.ws.rs</groupId> <artifactId>jakarta.ws.rs-api</artifactId> <version>3.1.0</version> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-core</artifactId> <version>4.7.9.Final</version> <exclusions> <exclusion> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> </exclusion> </exclusions> </dependency>
文件夹中的Additional Jars:

providers

    jakarta.ws.rs-api-4.0.0.jar
  • javax.ws.rs-api-2.1.1.jar
  • json-20240303.jar
  • keycloak-admin-client-26.0.4.jar
  • resteasy-client-6.2.11.Final.jar
  • resteasy-core-4.7.9.Final.jar
  • resteasy-jackson2-provider-4.7.9.Final.jar
  • resteasy-multipart-provider-6.2.11.Final.jar
  • 
    

    我怀疑
  • wildfly-client-config-1.0.1.Final.jar
  • jakarta.ws.rs

    之间的冲突,但我不确定如何解决。
    
    我可以修复它?

您正在使用Resteasy版本的混合物,您不应该这样做。您还包括两个不同版本的Jakarta Rest API,它们与Wildfly 26不兼容,一个雅加达EE 8兼容的容器。

resteasy版本应为4.7.7. for Wildfly 26。resteasy 6.2版本的目标jakarta REST 3.1,该版本包含在Jakarta EE 10中。

雅加达休息4.0 API,用于雅加达EE 11和Resteasy 7.0.x实施该规范。
简而言之,您是对的,这是一个vs
javax.ws.rs
命名空间问题。您也不应该在野生蝇提供的那样,在部署中包括任何Resteasy和Jakarta规格库。

build migration keycloak resteasy keycloak-rest-api
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.