hibernate/hibernate-orm · error · IllegalArgumentException

Illegal attempt to locate field [" + propertyName + "] on Ob

Error message

Illegal attempt to locate field [" + propertyName + "] on Object.class

What it means

Error "Illegal attempt to locate field [" + propertyName + "] on Object.class" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java:393

			return null;
		}
	}

	public static Method getMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) {
		try {
			return clazz.getMethod( methodName, paramTypes );
		}
		catch (Exception e) {
			return null;
		}
	}

	public static Field findField(Class<?> containerClass, String propertyName) {
		if ( containerClass == null ) {
			throw new IllegalArgumentException( "Class<?> on which to find field [" + propertyName + "] cannot be null" );
		}
		else if ( containerClass == Object.class ) {
			throw new IllegalArgumentException( "Illegal attempt to locate field [" + propertyName + "] on Object.class" );
		}
		else {
			final Field field = locateField( containerClass, propertyName );
			if ( field == null ) {
				throw new PropertyNotFoundException(
						String.format(
								Locale.ROOT,
								"Could not locate field name [%s] on class [%s]",
								propertyName,
								containerClass.getName()
						)
				);
			}
			ensureAccessibility( field );
			return field;
		}
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Do not look up fields on Object.class; check the target class before recursing up the hierarchy.

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java:393 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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