Solved: Hibernate not autoscanning entity classes

Posted in Technical on February 10th, 2026 by p14nd4

I recently had to update an old Java (.war) JPA/Hibernate project (from Hibernate 5.4 to 7.2, among other things), and ran into org.hibernate.query.sqm.UnknownEntityException: Could not resolve root entity 'Foo' issues at runtime. (My classes were annotated with @Entity and named correctly.) Relatedly, when I tried to set jakarta.persistence.schema-generation.database.action to CREATE or similar (e.g., for testing in a new environment), it wouldn’t generate my tables.

This used to work, and while I discovered that explicitly adding <class>org.example.Foo.Bar</class>-type entries to my persistence.xml worked around the issue, that was dissatisfying, since everything indicated this should “just work” (as it had before), and I’d rather avoid adding additional touch-points that inevitably will be missed when some new @Entity class is added in the future.

Read more »
Tags: , ,

Java Failed to open input stream for socket: Socket is closed (Solved)

Posted in Technical on July 19th, 2019 by p14nd4

I’ve recently been debugging an old project I inherited that features a [mostly] Java server and C++ client. I think it was mostly written 10–15 years ago (Java 6 at the latest), and probably not touched a whole lot since then, so while it’s all too easy to complain about any code, let alone old code, and code written by anyone else (and I will), I do also have respect for the fact that it’s moderately complex and has generally worked for a long time.

Although there’s plenty of low-hanging fruit for improvement in the project, the killer has been an issue seen when the system isn’t started up or shut down in its preferred sequence and speed. I never identified a perfect recipe for reproducing the issue, but basically: sometimes the system would get into a state where some clients would connect, but then the server seemed to essentially stop letting anyone new in. The workaround was to stop all clients (luckily the clients in this case were actually other servers within our [customers’] control), stop the server, start the server, and then start up the clients one by one. This is annoying with four servers; it’s a major pain with 40. (For better or worse, nobody currently has more than that.)
Read more »

Tags: , ,