Deserializing a yml document gets Class not found

17 views
Skip to first unread message

Abs Lama

unread,
Jul 15, 2021, 2:57:47 AM7/15/21
to SnakeYAML
Stacktrace: https://paste.ubuntu.com/p/CPhNZ69rCS/
The class exists i checked it earlier. When i run my test code in IDE it worked.

Joachim Durchholz

unread,
Jul 15, 2021, 3:21:24 AM7/15/21
to snakeya...@googlegroups.com
Am 15.07.21 um 08:57 schrieb Abs Lama:
Such problems typically arise from classes not being available in
contexts where you expect to have them.

We lack some details here:

The programming language you're using (is it Kotlin?)

Is the data read and written in the same process, or in different processes?

What's the failing situation - is it a .jar file?

If it is a .jar file: Did you unpack it and look if the class is there?
There are multiple ways how a class could be present in the IDE but not
in the jar, e.g. in Eclipse, with the typical Maven-inspired setup,
classes from the test directory are available in the IDE but the jar
build excludes themj.

Regards,
Jo

Abs Lama

unread,
Jul 15, 2021, 4:08:42 AM7/15/21
to SnakeYAML
Programming language is kotlin. I checked the class by decompile the jar, use Class.forName and create a instance of the class. The data read/write is in the same process. 

Joachim Durchholz

unread,
Jul 17, 2021, 4:29:48 PM7/17/21
to snakeya...@googlegroups.com
Am 15.07.21 um 10:08 schrieb Abs Lama:
> I checked the class by decompile the
> jar, use Class.forName and create a instance of the class. The data
> read/write is in the same process.

Are class loaders involved?
The same bytecode, loaded through different class loaders, will give
different classes at runtime.
Unfortunately, standard error messages don't typically name the class
loader they are associated with, so you have to use your own diagnostics
to figure that out.

Regards,
Jo
Reply all
Reply to author
Forward
0 new messages