Spring native erro on execute builded image

Viewed 574

I'm doing a test project in which I'm trying to implement AOT with GRPC, it can compile the image through paketo but when running the generated image it shows the error: "Native reflection configuration for io.grpc.netty. shaded.io.netty.channel.socket.nio.NioSocketChannel.() is missing." I tried to guide the compilation of this class through @TypeHint(types = NioServerSocketChannel.class) but it didn't work.

Project: https://github.com/thukabjj/spring-boot-grpc/tree/main/simulacao

Print image execution

Has anyone experienced a similar error?

1 Answers

Yes, your hint is missing the method part... This is the hints i need to make my grpc work (the last one is for the error you describle)

@TypeHints({ //
    @TypeHint(typeNames = "io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerIndexField",
            fields = @FieldHint(name = "producerIndex", allowUnsafeAccess = true)), //
    @TypeHint(typeNames = "io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerLimitField",
            fields = @FieldHint(name = "producerLimit", allowUnsafeAccess = true)), //
    @TypeHint(typeNames = "io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueConsumerIndexField",
            fields = @FieldHint(name = "consumerIndex", allowUnsafeAccess = true)), //
    @TypeHint(typeNames = "io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields",
            fields = @FieldHint(name = "producerIndex", allowUnsafeAccess = true)), //
    @TypeHint(typeNames = "io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields",
            fields = @FieldHint(name = "producerLimit", allowUnsafeAccess = true)), //
    @TypeHint(typeNames = "io.grpc.netty.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields",
            fields = @FieldHint(name = "consumerIndex", allowUnsafeAccess = true)), //
    @TypeHint(typeNames = "io.grpc.netty.shaded.io.netty.buffer.AbstractByteBufAllocator", access = AccessBits.ALL),
    @TypeHint(typeNames = "io.grpc.netty.shaded.io.netty.channel.ReflectiveChannelFactory", access = AccessBits.ALL),
    @TypeHint(typeNames = "io.grpc.netty.shaded.io.netty.channel.socket.nio.NioSocketChannel", methods = @MethodHint(name = "<init>")) })
Related