An AbstractPersistentCollection will throw a NullPointerException if an object contains a lazy loaded collection where the encapsulating objected is loaded on one server, then replicated to another server, where the getter is called in a clustered environment.
Here's an example:
In a clustered environment, in a web application which supports distributable, on wildfly 10, with let's say 2 servers. If User is loaded on server one, and placed into the session, if retrieved on server 2, an invocation of getSearchingPreferences() will throw the null pointer as the uuid of the hibernate session factory is serialised within the AbstractPersistentCollection, but refers to the factory on server one, not server 2.
The proposed solution from smarlow is to use the factory name over the id.