hibernate/hibernate-orm · error · IllegalArgumentException

Class<?> on which to find field [" + propertyName + "] canno

Error message

Class<?> on which to find field [" + propertyName + "] cannot be null

What it means

Error "Class<?> on which to find field [" + propertyName + "] cannot be null" thrown in hibernate/hibernate-orm.

Source

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

			return clazz.getMethod( method.getName(), method.getParameterTypes() );
		}
		catch (Exception e) {
			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. Pass a non-null Class to the field lookup; null-check the declaring class first.

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java:390 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/08ba560b26083303. Report an issue: GitHub.