hibernate/hibernate-orm · error · IntegrationException

ValidatorFactory reference

Error message

ValidatorFactory reference (provided via '%s' setting) was not an instance of '%s': %s

What it means

Type check failure in the setting-interpretation helper for jakarta/jpa validation factory settings: the configured setting value could not be treated as a ValidatorFactory. The user put a non-ValidatorFactory value into the validation factory configuration property.

Solutions

  1. Verify the object referenced by the given setting actually is a jakarta.validation.ValidatorFactory instance.
  2. Remove mismatched javax.validation vs jakarta.validation artifacts from the classpath so only one validation API is visible.
  3. If using JNDI lookup for the factory, confirm the JNDI binding holds a ValidatorFactory and not some other resource.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: The ValidatorFactory supplied via configuration is of an incompatible type.

Common situations: Passing a non-jakarta ValidatorFactory (e.g. the old javax.validation one) through jakarta.persistence.validation.factory or a JNDI-bound factory after the javax-to-jakarta migration.


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

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/beanvalidation/TypeSafeActivator.java:725

			return jakartaValidationFactory;
		}
		final var jpaValidationFactory = cfgService.getSetting(
				JPA_VALIDATION_FACTORY,
				value -> validatorFactory( value, JPA_VALIDATION_FACTORY )
		);
		if ( jpaValidationFactory != null ) {
			DEPRECATION_LOGGER.deprecatedSetting( JPA_VALIDATION_FACTORY, JAKARTA_VALIDATION_FACTORY );
			return null;
		}
		return null;
	}

	private static ValidatorFactory validatorFactory(Object value, String setting) {
		if ( value instanceof ValidatorFactory validatorFactory ) {
			return validatorFactory;
		}
		else {
			throw new IntegrationException(
					String.format(
							Locale.ENGLISH,
							"ValidatorFactory reference (provided via '%s' setting) was not an instance of '%s': %s",
							setting,
							ValidatorFactory.class.getName(),
							value.getClass().getName()
					)
			);
		}
	}
}

View on GitHub (pinned to fad1729dce)