-
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
[native-image] failed to compile simple kafka consumer app to native image, reflection issue #532
Comments
what I think I'm supposed to do is use a reflection file like:
as that is the constructor of
|
What would be really great from a GraalVM usability perspective is that when it emits an error like this:
for it to also emit the choices in the format usable by the reflection file for easy copy/pasting. It seems like (I'm sure this is far more complicated than I'm making it sound, just talking about the usability perspective without understanding the cost) |
Thank you for your report! It doesn't look like this is actually an issue with reflection, but rather a limitation of our implementation of method handles, so I'm assigning this one to @christianwimmer. |
Ah! I was wondering about if it was a different issue as
|
I'm seeing the same behavior on RC4 (I know this isn't marked as fixed, just confirming that it is still there). |
Also trying to get this working - using kafka-clients 1.0.0 and graal RC4 - I sidestepped the snappy thing by creating a patched kafka-clients that doesn't do the availability methodHandle/invoke check. Now there seems to be an issue with the Deserializer config? This might not the same issue but I was just looking to also get a native kafka consumer running so I was excited to see someone else working on it. Stacktrace here looks like it is a reflection issue but I can't determine what is going wrong. Kafka config looks like its working on building the deserializer out of the string or class that you give in its properties, but even when providing the class to the consumer it still fails.
leads to -
The
|
Some time has passed since the latest comments in this issue, so I'll just hop in and ask if someone has made progress in compiling Kafka producers/consumers to a native image? |
I have the exact same problem with kafka Snappy compression method invocation. Given that this thread is a year old, may I ask how did you ended up solving this? |
@joshuavijay The problem appears to be related to method handlers. I asked in this issue if there is a workaround but could not get a response or comment yet. I'd be really interested in finding a workaround. |
@dnfehren Do you have that fork available still? I am curious... I think perhaps if you do not put the class names as strings into the consumer properties, but only pass instances of the ser/des (as your example code also does), then it will not have to do reflection. But with graalvm |
@blak3mill3r sorry, too long ago, good luck though |
FYI for future dumb self and for those coming from google, if you are getting this error and wonder ytf this is happening my Main class is so simple.. You will get this error if you define your entrypoint without the
Pretty weird error this kind of mistake thought? 🤷♂ @cstancu |
Good catch, and sorry for the missing check. In Line 288 in e4ac613
main method is public but not that it is static .
|
Any progress on this? |
The underlying issue here is incomplete |
FYI, the usage of method handles in this code was removed via apache/kafka#10123. |
I'm hitting a reflection issue with Kafka consumer libs. I'm unable to determine if it's something that can be worked around (and I'm just not doing the proper workaround).
The app I'm trying is here: https://github.com/tednaleid/rat/commit/cae18f0a6f0adc81295edcf0047bec5777b14589
When I compile that with graal 1.0.0-rc3:
and then try to build a native image from that jar file (using a reflection config file that I'm probably using wrong ):
I get this error:
full output:
In looking at the line failing, CompressionType.java:90, it is calling invoke:
and the underlying
SnappyConstructors.INPUT
is defined as:I've attempted to add
SnappyInputStream
to the reflection config file as directed in https://github.com/oracle/graal/blob/master/substratevm/REFLECTION.md but I'm either doing something wrong or it isn't possible with the current release.The text was updated successfully, but these errors were encountered: