Hi! 👋 I'm working on a UDP server, based on Aleph. The idea is to eventually ship it as a single binary, compiled via native-image. I got to the point where a binary is produced but I'm running into an issue: When the server starts I get an exception that NioDatagramChannel doesn't have a 0-arity public constructor https://github.com/ztellman/aleph/blob/d3dc2e9835b58fb53b957171765e8da68e52aa84/src/aleph/udp.clj#L51 The error doesn't happen when running the code directly via Lein or good old uberjar. Has anybody run into this problem? Or should I ask in #graalvm channel?
are you building for graal? that's impressive. i'd definitely wanna know how you achieved that. i couldn7t get netty to compile for graal yet.
Yeah, it works for the most part: https://github.com/lukaszkorecki/graleph
as for your problem, what are the versions of libraries (netty?) you're using? because 4.1.50-line does have a 0-arity constructor https://netty.io/4.1/api/io/netty/channel/socket/nio/NioDatagramChannel.html
That's the confusing part - I pinned all dependencies to 4.1.50-Final to make sure I'm using the right version
Let me gist the stack trace I get from the native-image version of the server
https://gist.github.com/lukaszkorecki/05009e8466c0c4aea570021bbc9123d7
can you check where your stuff gets installed to see what version of netty you actually get? because even 4.0 seems to have a 0-arity constructor for the class in question
also, does this happen if you run your native-image compiled binary outside of docker?
The dependencies are correct, according to lein deps :tree
output - everything is pointing at 4.1.50-Final version
Let me check running the binary outside of Docker - I develop in a Linux VM anyway, but worth double checking that
Yep, same error
does the same binary fail inside the linux vm?
Yeah. Looks like it's related to the reflection config - more discussion on #graalvm channel.