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

Missing dependency while setting up webserver with oidc keycloak following the official tutorial #9470

Open
FedericoMenegoz opened this issue Nov 6, 2024 · 0 comments
Assignees
Labels

Comments

@FedericoMenegoz
Copy link

Environment Details

  • Helidon Version:4.1.3
  • Helidon SE
  • JDK version:
openjdk 22.0.1 2024-04-16
OpenJDK Runtime Environment Temurin-22.0.1+8 (build 22.0.1+8)
OpenJDK 64-Bit Server VM Temurin-22.0.1+8 (build 22.0.1+8, mixed mode, sharing)
  • OS: Zorin OS 17.2 Core 64bit
  • Docker version (if applicable): Docker version 27.3.1

Problem Description

I encounter some exception following this this guide while trying to setup keycloak with open id connect in Helidon.

Steps to reproduce

I followed step by step this guide and when I build and run the application I get this exception:

Exception in thread "main" java.lang.NoClassDefFoundError: io/helidon/webclient/api/WebClientConfig$Builder
        at io.helidon.security.providers.oidc.common.OidcConfig$Builder.build(OidcConfig.java:998)
        at io.helidon.security.providers.oidc.common.OidcConfig.create(OidcConfig.java:464)
        at io.helidon.security.providers.oidc.OidcFeature$Builder.config(OidcFeature.java:695)
        at java.base/java.util.Optional.ifPresentOrElse(Optional.java:196)
        at io.helidon.security.providers.oidc.OidcFeature$Builder.config(OidcFeature.java:724)
        at io.helidon.security.providers.oidc.OidcFeature.create(OidcFeature.java:218)
        at io.helidon.examples.quickstart.se.Main.routing(Main.java:59)
        at io.helidon.webserver.WebServerConfigSupport$ListenerCustomMethods.routing(WebServerConfigSupport.java:158)
        at io.helidon.webserver.ListenerConfig$BuilderBase.routing(ListenerConfig.java:277)
        at io.helidon.examples.quickstart.se.Main.main(Main.java:42)
Caused by: java.lang.ClassNotFoundException: io.helidon.webclient.api.WebClientConfig$Builder
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        ... 10 more

I added the following dependencies:

<dependency>
    <groupId>io.helidon.webclient</groupId>
    <artifactId>helidon-webclient-api</artifactId>
</dependency>
<dependency>
    <groupId>io.helidon.webclient</groupId>
    <artifactId>helidon-webclient-http1</artifactId>
</dependency>

Then I got the following exception:

Exception in thread "main" io.helidon.common.config.ConfigException: Unknown provider configured. Expected providers with types: [security], but only the following providers are supported: [cors, observe], provider interface: io.helidon.webserver.spi.ServerFeatureProvider, configured service: io.helidon.webserver.spi.ServerFeature
	at io.helidon.builder.api.ProvidedUtil.servicesFromObject(ProvidedUtil.java:231)
	at io.helidon.builder.api.ProvidedUtil.discoverServices(ProvidedUtil.java:168)
	at io.helidon.builder.api.Prototype$ConfiguredBuilder.discoverServices(Prototype.java:122)
	at io.helidon.webserver.WebServerConfig$BuilderBase.preBuildPrototype(WebServerConfig.java:443)
	at io.helidon.webserver.WebServerConfig$Builder.buildPrototype(WebServerConfig.java:655)
	at io.helidon.webserver.WebServerConfig$Builder.build(WebServerConfig.java:662)
	at io.helidon.examples.quickstart.se.Main.main(Main.java:43)

Finally I added this dependency:

<dependency>
    <groupId>io.helidon.webserver</groupId>
    <artifactId>helidon-webserver-security</artifactId>
</dependency>

Now everything seems working, but it is not clear to me why I needed to add helidon-webclient-api and helidon-webclient-http1 while working on a web server. Could you please clarify if this is the right approach?
Cheers

@tvallin tvallin self-assigned this Nov 6, 2024
@m0mus m0mus added docs security 4.x Version 4.x labels Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Sprint Scope
Development

No branches or pull requests

3 participants