New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running the HelloWorld example #2

Closed
implicit-invocation opened this Issue Sep 13, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@implicit-invocation
Copy link

implicit-invocation commented Sep 13, 2018

2018-09-13 11:44:20 ERROR KryoSerialiser:87 - Couldn't stream from byte array.
com.esotericsoftware.kryo.KryoException: Class cannot be created (missing no-arg constructor): com.jfastnet.messages.ConnectResponse
	at com.esotericsoftware.kryo.Kryo$DefaultInstantiatorStrategy.newInstantiatorOf(Kryo.java:1310)
	at com.esotericsoftware.kryo.Kryo.newInstantiator(Kryo.java:1127)
	at com.esotericsoftware.kryo.Kryo.newInstance(Kryo.java:1136)
	at com.esotericsoftware.kryo.serializers.FieldSerializer.create(FieldSerializer.java:559)
	at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:535)
	at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:813)
	at com.jfastnet.serialiser.KryoSerialiser.deserialise(KryoSerialiser.java:81)
	at com.jfastnet.peers.javanet.JavaNetPeer.receive(JavaNetPeer.java:128)
	at com.jfastnet.peers.javanet.JavaNetPeer$MessageReceivingRunnable.run(JavaNetPeer.java:181)
	at java.lang.Thread.run(Thread.java:745)
@klaus7

This comment has been minimized.

Copy link
Owner

klaus7 commented Sep 13, 2018

Interesting, thanks! I identified that it was working correctly with Kryo 3.0.0, but not with Kryo 4.0.0 - will look into it.

@klaus7 klaus7 closed this in e42c534 Sep 13, 2018

@klaus7

This comment has been minimized.

Copy link
Owner

klaus7 commented Sep 13, 2018

It was because of this commit: EsotericSoftware/kryo@bfc02be

And I didn't notice, because I configure all my kryo objects like this in my projects:
kryo.setInstantiatorStrategy(new DefaultInstantiatorStrategy(new StdInstantiatorStrategy()));

This way, you don't require a no-arg constructor. Thanks for sharing the issue! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment