hibernate/hibernate-orm · error · IllegalArgumentException

The provided {} setting value [{}] is not supported

Error message

The provided {} setting value [{}] is not supported

What it means

Thrown by EntityManagerFactoryBuilderImpl.loadSettingInstance() as an IllegalArgumentException when the value supplied for a class-typed setting is neither an instance of the expected type, nor a Class object, nor a String. loadSettingInstance only supports those three forms, so any other Java object (Integer, Boolean, enum, custom type) is rejected at boot with the setting name and offending value in the message.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java:1725

			instanceClass = (Class<? extends T>) settingValue;
		}
		else if ( settingValue instanceof String className ) {
			if ( standardServiceRegistry != null ) {
				instanceClass =
						standardServiceRegistry.requireService( ClassLoaderService.class )
								.classForName( className );
			}
			else {
				try {
					instanceClass = (Class<? extends T>) Class.forName( className );
				}
				catch (ClassNotFoundException e) {
					throw new IllegalArgumentException( "Can't load class: " + className, e );
				}
			}
		}
		else {
			throw new IllegalArgumentException( "The provided " + settingName
					+ " setting value [" + settingValue + "] is not supported" );
		}

		if ( instanceClass != null ) {
			try {
				return instanceClass.newInstance();
			}
			catch (InstantiationException | IllegalAccessException e) {
				throw new IllegalArgumentException(
						"The " + clazz.getSimpleName() +" class [" + instanceClass + "] could not be instantiated",
						e
				);
			}
		}
		else {
			return null;
		}
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Change the value to the fully-qualified class name string of your implementation.
  2. Or pass the Class object itself (MyInterceptor.class) in programmatic configuration.
  3. Or pass a pre-constructed instance of the implementation.
  4. Audit the config source that produced the value (message shows it) and fix its type conversion.

Example fix

// before
Map<String,Object> settings = new HashMap<>();
settings.put("hibernate.session_factory.observer", 42); // unsupported type

// after
settings.put("hibernate.session_factory.observer", MyObserver.class.getName());
Defensive patterns

Strategy: validation

Validate before calling

// only the 3 supported forms are allowed
Object v = settings.get(SETTING_KEY);
if (!(v instanceof String || v instanceof Class || expectedType.isInstance(v))) {
    throw new IllegalArgumentException(SETTING_KEY + " must be an instance, Class, or FQCN String, got: " + (v == null ? "null" : v.getClass()));
}

Prevention

When it happens

Trigger: Putting a non-String/Class/instance object into configurationValues for a setting handled by loadSettingInstance - e.g. an enum constant, a boxed primitive, or a config-binding object from a typed config source (Spring's Environment adapters, MicroProfile Config converters).

Common situations: Migration from String-based properties to typed configuration maps where a converter already produced a non-String object; copy-pasting a value of the wrong type into a bootstrap config map; frameworks injecting typed values where Hibernate expects instance/Class/FQCN-string.

Related errors


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