-
Notifications
You must be signed in to change notification settings - Fork 101
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
Error connecting to Confluent Kafka when running as native image #264
Comments
Have you tried |
Where should I put the argument though? I assume I can't just pass it to the buildDockerNative Gradle command? |
Use in nativeImage {
args("-H:IncludeResourceBundles=sun.security.util.Resources")
} |
Tried it, it doesn't work. I get the same error message.
The -H:IncludeResourceBundles argument gets added to the ENTRYPOINT line, but I think I need it to be added as an argument to the RUN native-image line |
I got a bit further. I copied the generated DockerFileNative and moved the IncludeResource flag to the RUN native-image line. I then ran docker build against that dockerfile. I now get a different SASL exception:
I think it is noteworthy that I recognize this error from the quarkus issue thread I mentioned earlier: |
You could try copy this substitution into your code base to see if it resolves it If it does it may make sense to gather all your modifications and turn them into a PR so this works in Micronaut out of the box |
Yes, this works! Thank you for your swift replies and help :) |
@joost-lambregts could you post your final native image config settings, so someone can turn these discoveries into a PR |
To sum up what I did: I added the following TypeHint to my Application class. I'm not sure if you need all those classes:
I manually ran the docker build instead of using gradel dockerBuildNative. I used the DockerFileNative generated by gradle dockerBuildNative but added the -H:IncludeResourceBundles=sun.security.util.Resources parameter to the RUN native-image line. My final DockerFile looks like this:
I added this class to my codebase: https://github.com/quarkusio/quarkus/pull/8817/files#diff-684881d26520d00c62011b100c114e743058debe648a676eff55ef1e4fcbbb05R35 For that class to compile I also needed to add the following dependency to my gradle build: I think that's it. If you have any questions let me know. |
I am trying to post a message to a Kafka topic on Confluent Cloud using micronaut-kafka. When I don't build my application as a native image, everything works fine. When I do build a native image (using gradle dockerBuildNative) the application runs into an error while trying to authenticate at Confluent Cloud. I'm using plain SASL/JAAS as an authentication mechanism.
While googling the error I came across an issue in the quarkus github that looks very similar: quarkusio/quarkus#5254. Perhaps looking into this issue will help in resolving the issue for Micronaut as well.
I tried to resolve the issue by adding a TypeHint annotation. This seemed to resolve the original error but I ran into a new one and got stuck. I will share both stacktraces.
Steps to Reproduce:
Expected Behaviour
Message get's posted to Confluent Kafka
Actual Behaviour
I get the following stacktrace as soon as I try to post a message to my Kafka topic:
After this, I tried to add the following TypeHInt annotation (inspired by some comment in the quarkus issue):
@TypeHint({org.apache.kafka.common.security.plain.PlainLoginModule.class, ProducerKafkaMetricsReporter.class, SaslClientCallbackHandler.class,SaslClientCallbackHandler.class, DefaultLogin.class, AbstractLogin.DefaultLoginCallbackHandler.class})
With this typehint, I get the following stacktrace instead:
Environment Information
The text was updated successfully, but these errors were encountered: