question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying to register SPI causes build step error

See original GitHub issue

Describe the bug

I have written a User Storage Provider and it worked fine in versions before 17. When trying to register it with Keycloak 17, I get the exception message: Build step org.keycloak.quarkus.deployment.KeycloakProcessor#configureProviders threw an exception: java.util.ServiceConfigurationError: org.keycloak.provider.Spi: org.keycloak.locale.LocaleSelectorSPI not a subtype

I have reproduced this issue using Java 11 and 17 on both Windows and Linux.

Version

17.0.0

Expected behavior

When I copy the JAR file into the providers directory and run ./kc.sh build, a success message is printed and the provider is registered.

Actual behavior

The following error is printed: image

How to Reproduce?

  1. Create an Provider and a ProviderFactory class. No special logic aside from the implementations are required.
  2. Register the Factory class in the META-INF/services/org.keycloak.storage.UserStorageProviderFactory file.
  3. Create the JAR file using mvn clean compile assembly:single
  4. Copy the JAR file into Keycloak’s providers directory.
  5. Run ./kc.sh build

Anything else?

My folder structure: image

My pom.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>de.collinalpert</groupId>
    <artifactId>my-user-provider</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <java.version>11</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.compiler.release>${java.version}</maven.compiler.release>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-server-spi</artifactId>
            <version>17.0.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <finalName>my-user-provider</finalName>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <appendAssemblyId>false</appendAssemblyId>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
CollinAlpertcommented, Feb 22, 2022

Adding <scope>provided</scope> to the Keycloak dependencies solved my issue. Thanks!

0reactions
dishi-githubcommented, Jun 28, 2022

Thank you so much. I had the same issue with keycloak 18 and this post sort of fixed my issues for once due to the detailed steps provided to reproduce it. Thanks again! Appreciate!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How I can proper handle the SPI read register function? I am ...
I am working in stmcubeide and trying to find a problem in dubbing which is based on spi_read function. All am doing is...
Read more >
What Could Go Wrong: SPI | Hackaday
Serial Peripheral Interface (SPI) is not really a protocol, but more of a general idea. It's the bare-minimum way to transfer a lot...
Read more >
Error with SPI Communication using DMA
The code on bus 5 runs perfectly until I make a slave request on bus 1. From then on, the data sent over...
Read more >
AM4378 error in booting from SPI Flash - Processors forum
Are you trying to boot from SPI or use SPI after booting? ... to include "$uboot/drivers/spi/omap3_spi.c" file into the u-boot build:
Read more >
STM32F407 SPI RXNE flag bit clears automatically
As this is an example I am trying to build, I skipped to exit the ... the RXNE bit gets cleared even when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found