79566578

Date: 2025-04-10 12:06:35
Score: 0.5
Natty:
Report link

So the problem was that I was using spring-boot-devtools which has a restart function. The restart class loader couldn't find the classes.

I got the hint when I tried to make a temporary workaround to cast the content of the Tuple to the correct type.

private <T> T getObject(Tuple tuple, T c) {
  return (T) tuple.get(0);
}

Then I used it like this

var customer = session.createQuery("FROM Customer", Tuple.class).getSingleResultOrNull();
return getObject(customer, new Customer());

Which threw a class loader exception which then led me to the following post with the solution.
Class loader error - unnamed module of loader org.springframework.boot.devtools.restart.classloader.RestartClassLoader
Disabling the restart function didn't work for me so I simply removed devtools from Maven.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Charlie