kryonet icon indicating copy to clipboard operation
kryonet copied to clipboard

Issues with Graal Native Images

Open AnthonyRuffino opened this issue 5 years ago • 2 comments

I am trying to run an application as a Graal Native image which sets up a simple Kryonet server from the examples on this git page, but I have coming across the following issue. Any chance the devs of this project could make asmall working example of a Kryonet server ruinning as a native image?

Exception in thread "main" java.lang.IllegalArgumentException: Unable to create serializer "com.esotericsoftware.kryo.serializers.FieldSerializer" for class: com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP at com.esotericsoftware.kryo.factories.ReflectionSerializerFactory.makeSerializer(ReflectionSerializerFactory.java:48) at com.esotericsoftware.kryo.factories.ReflectionSerializerFactory.makeSerializer(ReflectionSerializerFactory.java:26) at com.esotericsoftware.kryo.Kryo.newDefaultSerializer(Kryo.java:351) at com.esotericsoftware.kryo.Kryo.getDefaultSerializer(Kryo.java:344) at com.esotericsoftware.kryo.Kryo.register(Kryo.java:365) at com.esotericsoftware.kryonet.KryoSerialization.(KryoSerialization.java:31) at com.esotericsoftware.kryonet.KryoSerialization.(KryoSerialization.java:23) at com.esotericsoftware.kryonet.Server.(Server.java:91) ....

Caused by: java.lang.InstantiationException: Type com.esotericsoftware.kryo.serializers.FieldSerializer can not be instantiated reflectively as it does not have a no-parameter constructor or the no-parameter constructor has not been added explicitly to the native image. at java.lang.Class.newInstance(DynamicHub.java:850) at com.esotericsoftware.kryo.factories.ReflectionSerializerFactory.makeSerializer(ReflectionSerializerFactory.java:43) ... 11 more

AnthonyRuffino avatar Oct 30 '20 01:10 AnthonyRuffino

Can you tell Graal to add no-parameters constructor to all classes?

RobertZenz avatar Oct 30 '20 09:10 RobertZenz

I do not think that is a feature of Graal.

AnthonyRuffino avatar Nov 19 '20 11:11 AnthonyRuffino