-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Spring Kafka with GraalVM - org.apache.kafka.common.errors.SaslAuthenticationException: Failed to create SaslClient with mechanism PLAIN #2545
Comments
Looks like it fails here:
Which is really a call to
The Java's ServiceLoader cannot load any I don't know, they claim here that there is some fix in GraalVM: oracle/graal#3664, but then we need to be sure that you use the latest GraalVM for your project. Either way it is probably better to raise this concern with GraalVM team: not sure what Spring responsibility could be involved with this feature... |
Here is some old discussion as well: spring-attic/spring-native#1416. |
This article says something promising: https://jeqo.github.io/posts/2022-03-18-kafka-clients-graalvm/#sasl-authentication
Just give it a try, please! |
Thank you very much for the feedback it helped a lot to point me in the right direction and I did have some breakthroughs, I will provide final feedback soon when I get the below optimized. Currently I have the following that fixed that issue: Reflections:
Build arg added - -H:AdditionalSecurityProviders=com.sun.security.sasl.Provider I still need to experiment with Not sure if the runtime arg suggestion would be better or if reflections is better from a image optimization point of view? Currently the above mentioned allows the project to startup with graalvm, however I find that the kafka SSL properties isn't getting loaded with graalvm In the spring boot properties the producer's ssl trust store type and location is set, but on graalvm it does not want to pick up the ssl properties specifically, although it picks up the rest. (on JVM it works). My yaml again:
Only spring.producer.ssl doesnt pickup Spring logs
Thus it doesnt load the SSL properties at all, it uses defaults, and this causes the SSL PKIX path issue. So I am still trying to figure out why those properties wont build with graalvm and Spring Boot Autoconfiguration This is the method that sets the properties Please let me know if you have any ideas. Thanks for the support |
When I put reflections for all classes on for the whole apache.kafka package then everything works. Im struggling to find what the right reflection is needed to pickup the SSL config for the producer :( |
In one of my environments, I kept getting the same error:
This error only occurred when the code was running on a Kubernetes server, while it worked perfectly fine locally. I changed the image used to build the native image from ghcr.io/graalvm/graalvm-ce:22.3.1 to ghcr.io/graalvm/graalvm-community:17-ol9. While the specific version is likely not a crucial factor, updating the GraalVM version seems to do the job |
In what version(s) of Spring for Apache Kafka are you seeing this issue?
3.0.1
Describe the bug
I am still new to Spring boot 3 aot. Best I can describe it is that I've used the spring boot 3 native profile defaults, but I get the following error only on graalvm, not on the JVM:
To Reproduce
Any project with spring boot 3.0.1, spring-kafka and the following configuration in the application.yml
Expected behavior
I expect the required reflections and hints to be available and not receive this error that I am not sure how to resolve.
The text was updated successfully, but these errors were encountered: