hibernate/hibernate-orm · error · PropertyAccessSerializationException

Unable to resolve field on deserialization : " + declaringCl

Error message

Unable to resolve field on deserialization : " + declaringClass.getName() + "#" + fieldName

What it means

Field-based property accessors serialize themselves as a compact serial form holding only (declaringClass, fieldName). On deserialization, AbstractFieldSerialForm.resolveField re-locates the Field reflectively; if the class version on the reading JVM no longer declares that field, NoSuchFieldException is wrapped in PropertyAccessSerializationException.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/property/access/internal/AbstractFieldSerialForm.java:38

	private final String fieldName;

	protected AbstractFieldSerialForm(Field field) {
		this( field.getDeclaringClass(), field.getName() );
	}

	protected AbstractFieldSerialForm(Class<?> declaringClass, String fieldName) {
		this.declaringClass = declaringClass;
		this.fieldName = fieldName;
	}

	protected Field resolveField() {
		try {
			final var field = declaringClass.getDeclaredField( fieldName );
			ReflectHelper.ensureAccessibility( field );
			return field;
		}
		catch (NoSuchFieldException e) {
			throw new PropertyAccessSerializationException(
					"Unable to resolve field on deserialization : " + declaringClass.getName() + "#" + fieldName
			);
		}
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Clear or expire serialized caches whenever entity classes change
  2. Deploy identical entity classes (and the same Hibernate version) on every node that shares serialized state
  3. Avoid renaming or removing mapped fields in a single step; do it across releases with cache invalidation in between
  4. If hit during an upgrade, flush the affected cache/store so entries are rebuilt with the current class shape
Defensive patterns

Strategy: try-catch

Try / catch

try (ObjectInputStream in = new ObjectInputStream(bytes)) {
    Object cached = in.readObject();
} catch (org.hibernate.PropertyAccessSerializationException e) {
    // entity class shape changed since serialization: drop the cached entry and rebuild
}

Prevention

When it happens

Trigger: Deserializing a cached or clustered artifact that embeds a serialized PropertyAccess (for example a serialized query plan or domain payload carried across nodes) after the entity class was recompiled with that field renamed or removed.

Common situations: Rolling deployments where nodes run different entity class versions; persistent serialization caches that survive refactors; a cluster mixing Hibernate versions that serialize accessors with different shapes; field renamed or dropped between releases.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/c5ac2c8f934a07c1. Report an issue: GitHub.