Skip to content

ClassNotFoundException is not serializable for Adoptium jdk 17 #78

@temppost2

Description

@temppost2

When RpcSession fails with deserialization of incoming request, in particular, when some method or class is missing on server side, it throws ClassNotFoundException and tries to RpcSession#writeResponse with this exception. But RpcSession#writeResponse fails too, because ClassNotFoundException cannot be serialized.

It leads to the following exception on server side:

16:23:18,095|W|[NIO Selector #2] Local type not found: EchoService$Message
16:23:18,117|E|[NIO Selector #2] Cannot process session from 127.0.0.1
java.io.IOException: writeObject() is not fully supported. See implementation notes.
	at one.nio.serial.gen.NullObjectOutputStream.unsupported(NullObjectOutputStream.java:159)
	at one.nio.serial.gen.NullObjectOutputStream.putFields(NullObjectOutputStream.java:50)
	at java.base/java.lang.ClassNotFoundException.writeObject(ClassNotFoundException.java:144)
	at sun.reflect.Delegate0_ClassNotFoundException.calcSize(Unknown Source)
	at one.nio.serial.GeneratedSerializer.calcSize(GeneratedSerializer.java:116)
	at one.nio.serial.CalcSizeStream.writeObject(CalcSizeStream.java:129)
	at one.nio.rpc.RpcSession.writeResponse(RpcSession.java:196)
	at one.nio.rpc.RpcSession.handleDeserializationException(RpcSession.java:250)
	at one.nio.rpc.RpcSession.processRead(RpcSession.java:108)
	at one.nio.net.Session.process(Session.java:222)
	at one.nio.server.SelectorThread.run(SelectorThread.java:70)

  • Both client and server runs on openjdk version "17.0.9" 2023-10-17
  • Checked on one-nio 1.6.1 and 1.7.1

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions