我正在做一个测试项目,其中我试图用GRPC实现AOT,它可以通过paketo编译图像,但当运行生成的图像时,它显示错误:"Native reflection for io.grpc.netty. shaded.io.netty.channel.socket.nio.NioSocketChannel.() is missing。“我试图通过@TypeHint(types = NioServerSocketChannel.class)指导这个类的编译,但它不起作用。
项目:https://github.com/thukabjj/spring-boot-grpc/tree/main/simulacao
有没有人遇到过类似的错误?
发布于 2021-08-25 05:06:23
是的,你的提示遗漏了方法部分...这是使我的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>")) })
https://stackoverflow.com/questions/68639801
复制相似问题