2

我正在做一个测试项目,我正在尝试使用 GRPC 实现 AOT,它可以通过 paketo 编译图像,但是在运行生成的图像时它显示错误:“io.grpc.netty 的本机反射配置。阴影。 io.netty.channel.socket.nio.NioSocketChannel.() 丢失。” 我试图通过@TypeHint(types = NioServerSocketChannel.class) 来指导这个类的编译,但是没有成功。

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

打印图像执行

有没有人遇到过类似的错误?

4

1 回答 1

1

是的,你的提示缺少方法部分......这是我需要让我的 grpc 工作的提示(最后一个是你描述的错误)

@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>")) })
于 2021-08-25T13:06:23.163 回答